Magnum::Ui::BaseLayerGL class new in Git master

OpenGL implementation of the base layer.

The layer assumes RendererGL is set on the user interface (or UserInterfaceGL used, which does so automatically), see its documentation for more information about GL state expectations. The layer produces geometry in a counter-clockwise winding, so GL::Renderer::Feature::FaceCulling can stay enabled when drawing it.

Base classes

class BaseLayer new in Git master
Base layer.

Public types

class Shared
Shared state for the OpenGL implementation of the base layer.

Constructors, destructors, conversion operators

BaseLayerGL(LayerHandle handle, Shared& shared) explicit
Constructor.

Public functions

auto shared() -> Shared&
Shared state used by this layer.
auto shared() const -> const Shared&
auto setTexture(GL::Texture2DArray& texture) -> BaseLayerGL&
Set a texture to draw with.
auto setTexture(GL::Texture2DArray&& texture) -> BaseLayerGL&
Set a texture to draw with, taking over its ownership.

Protected functions

void doComposite(AbstractRenderer& renderer, const Containers::StridedArrayView1D<const Vector2>& compositingRectOffsets, const Containers::StridedArrayView1D<const Vector2>& compositingRectSizes, std::size_t offset, std::size_t count) override
Composite previously rendered contents.
void doDraw(const Containers::StridedArrayView1D<const UnsignedInt>& dataIds, std::size_t offset, std::size_t count, const Containers::StridedArrayView1D<const UnsignedInt>& clipRectIds, const Containers::StridedArrayView1D<const UnsignedInt>& clipRectDataCounts, std::size_t clipRectOffset, std::size_t clipRectCount, const Containers::StridedArrayView1D<const Vector2>& nodeOffsets, const Containers::StridedArrayView1D<const Vector2>& nodeSizes, Containers::BitArrayView nodesEnabled, const Containers::StridedArrayView1D<const Vector2>& clipRectOffsets, const Containers::StridedArrayView1D<const Vector2>& clipRectSizes) override
Draw a sub-range of visible layer data.

Function documentation

Magnum::Ui::BaseLayerGL::BaseLayerGL(LayerHandle handle, Shared& shared) explicit

Constructor.

Parameters
handle Layer handle returned from AbstractUserInterface::createLayer()
shared Shared state containing style data

The shared state is expected to be kept in scope for the whole class lifetime. In order to draw the layer it's expected that Shared::setStyle() was called. In case BaseLayerSharedFlag::Textured was enabled, additionally it's expected that setTexture() was called as well.

Shared& Magnum::Ui::BaseLayerGL::shared()

Shared state used by this layer.

Reference to the instance passed to BaseLayerGL::BaseLayerGL(LayerHandle, Shared&).

const Shared& Magnum::Ui::BaseLayerGL::shared() const

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

BaseLayerGL& Magnum::Ui::BaseLayerGL::setTexture(GL::Texture2DArray& texture)

Set a texture to draw with.

Returns Reference to self (for method chaining)

Expects that the layer was constructed with a shared state that has BaseLayerSharedFlag::Textured. The texture is expected to stay alive for as long as the layer is drawn. Use setTexture(GL::Texture2DArray&&) to make the layer take ownership of the texture instead.

BaseLayerGL& Magnum::Ui::BaseLayerGL::setTexture(GL::Texture2DArray&& texture)

Set a texture to draw with, taking over its ownership.

Returns Reference to self (for method chaining)

Compared to setTexture(GL::Texture2DArray&) takes over ownership of the texture instance.

void Magnum::Ui::BaseLayerGL::doComposite(AbstractRenderer& renderer, const Containers::StridedArrayView1D<const Vector2>& compositingRectOffsets, const Containers::StridedArrayView1D<const Vector2>& compositingRectSizes, std::size_t offset, std::size_t count) override protected

Composite previously rendered contents.

It's possible for a subclass to override this function to perform extra GL state changes and then delegate to the parent implementation. As the implementation doesn't track current GL state in any way at the moment, the state should be reset back to the previous afterwards. See AbstractLayer::doComposite() for more information about how this function is called.

void Magnum::Ui::BaseLayerGL::doDraw(const Containers::StridedArrayView1D<const UnsignedInt>& dataIds, std::size_t offset, std::size_t count, const Containers::StridedArrayView1D<const UnsignedInt>& clipRectIds, const Containers::StridedArrayView1D<const UnsignedInt>& clipRectDataCounts, std::size_t clipRectOffset, std::size_t clipRectCount, const Containers::StridedArrayView1D<const Vector2>& nodeOffsets, const Containers::StridedArrayView1D<const Vector2>& nodeSizes, Containers::BitArrayView nodesEnabled, const Containers::StridedArrayView1D<const Vector2>& clipRectOffsets, const Containers::StridedArrayView1D<const Vector2>& clipRectSizes) override protected

Draw a sub-range of visible layer data.

It's possible for a subclass to override this function to perform extra GL state changes and then delegate to the parent implementation. As the implementation doesn't track current GL state in any way at the moment, the state should be reset back to the previous afterwards. Note that blending and scissor enabled state is already taken care of by LayerFeature::DrawUsesBlending and LayerFeature::DrawUsesScissor. See AbstractLayer::doDraw() for more information about how this function is called.