template<class InstanceData>
Magnum::Ui::BasicInstancedGLLayer class

Base for instanced layers with OpenGL backend.


Adds OpenGL mesh and buffer management on top of BasicInstancedLayer.

Base classes

template<class InstanceData>
class BasicInstancedLayer<InstanceData>
Base for instanced layers.

Public functions

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

Function documentation

template<class InstanceData>
void Magnum::Ui::BasicInstancedGLLayer<InstanceData>::reset(std::size_t capacity, GL::BufferUsage usage)

Reset the layer.

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

template<class InstanceData>
void Magnum::Ui::BasicInstancedGLLayer<InstanceData>::update()

Update the 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.