template<class VertexData>
Magnum::Ui::BasicGLLayer class

Layer with OpenGL backend.

Contents

Adds OpenGL mesh and buffer management on top of BasicLayer.

Base classes

template<class VertexData>
class BasicLayer
Basic layer.

Public functions

auto buffer() -> GL::Buffer&
Vertex data buffer.
auto mesh() -> GL::Mesh&
Layer mesh.
void reset(std::size_t elementCapacity, std::size_t dataCapacity, GL::BufferUsage usage)
Reset the layer.
void update()
Update a layer.
void draw(AbstractUiShader& shader)
Draw the layer using provided shader.

Function documentation

template<class VertexData>
void Magnum::Ui::BasicGLLayer<VertexData>::reset(std::size_t elementCapacity, std::size_t dataCapacity, GL::BufferUsage usage)

Reset the layer.

Allocates CPU and GPU memory to store given elementCapacity of elements and dataCapacity of vertices, clearing everything that has been set before. If current memory capacity is larger or equal to elementCapacity/capacity, no reallocation is done.

template<class VertexData>
void Magnum::Ui::BasicGLLayer<VertexData>::update()

Update a layer.

Copies all data modified using modifyElement() to GPU memory. Called automatically at the beginning of BasicUserInterface::draw(), but scheduling it explicitly in a different place might reduce the need for CPU/GPU synchronization.