class new in Git master
#include <Magnum/Ui/AbstractRenderer.h>
AbstractRenderer Base for renderer implementations.
A renderer implementation handles GPU-API-specific framebuffer switching, clearing and draw state setup. You'll most likely instantiate the class through RendererGL, which contains a concrete OpenGL implementation.
Derived classes
- class RendererGL new in Git master
- OpenGL renderer implementation.
Constructors, destructors, conversion operators
- AbstractRenderer() explicit
- Constructor.
- AbstractRenderer(const AbstractRenderer&) deleted
- Copying is not allowed.
- AbstractRenderer(AbstractRenderer&&) noexcept
- Move constructor.
Public functions
- auto operator=(const AbstractRenderer&) -> AbstractRenderer& deleted
- Copying is not allowed.
- auto operator=(AbstractRenderer&&) -> AbstractRenderer& noexcept
- Move assignment.
- auto features() const -> RendererFeatures
- Features supported by a renderer.
- auto framebufferSize() const -> Vector2i
- Framebuffer size.
- auto currentTargetState() const -> RendererTargetState
- Current target state.
- auto currentDrawStates() const -> RendererDrawStates
- Current draw states.
- void setupFramebuffers(const Vector2i& size)
- Set up framebuffer properties.
- void transition(RendererTargetState targetState, RendererDrawStates drawStates)
- Transition to the next renderer state.
Private functions
- auto doFeatures() const -> RendererFeatures pure virtual
- Implementation for features()
- void doSetupFramebuffers(const Vector2i& size) pure virtual
- Set up framebuffer properties.
- void doTransition(RendererTargetState targetStateFrom, RendererTargetState targetStateTo, RendererDrawStates drawStatesFrom, RendererDrawStates drawStatesTo) pure virtual
- Transition to the next renderer state.
Function documentation
Magnum:: Ui:: AbstractRenderer:: AbstractRenderer(AbstractRenderer&&) noexcept
Move constructor.
Performs a destructive move, i.e. the original object isn't usable afterwards anymore.
Vector2i Magnum:: Ui:: AbstractRenderer:: framebufferSize() const
Framebuffer size.
Initial state is a zero vector. Use setupFramebuffers() to set up framebuffer properties.
RendererTargetState Magnum:: Ui:: AbstractRenderer:: currentTargetState() const
Current target state.
Initial state is RendererTargetState::
RendererDrawStates Magnum:: Ui:: AbstractRenderer:: currentDrawStates() const
Current draw states.
Initial state is an empty set. Gets subsequently updated with the states passed to transition().
void Magnum:: Ui:: AbstractRenderer:: setupFramebuffers(const Vector2i& size)
Set up framebuffer properties.
Used internally from AbstractUserInterface::
void Magnum:: Ui:: AbstractRenderer:: transition(RendererTargetState targetState,
RendererDrawStates drawStates)
Transition to the next renderer state.
Used internally from AbstractUserInterface::targetState
is expected to be an allowed transition from currentTargetState() and drawStates
is expected to match restrictions of given targetState
. If the set of states is different from currentTargetState() and currentDrawStates(), delegates to doTransition(), see its documentation for more information about the arguments. If the set is the same, the function is a no-op.
void Magnum:: Ui:: AbstractRenderer:: doSetupFramebuffers(const Vector2i& size) pure virtual private
Set up framebuffer properties.
Parameters | |
---|---|
size | Framebuffer size in pixels for allocating custom framebuffer memory, resetting the scissor rectangle and other framebuffer-related operations. |
Implementation for setupFramebuffers(), which is called from AbstractUserInterface::
void Magnum:: Ui:: AbstractRenderer:: doTransition(RendererTargetState targetStateFrom,
RendererTargetState targetStateTo,
RendererDrawStates drawStatesFrom,
RendererDrawStates drawStatesTo) pure virtual private
Transition to the next renderer state.
Parameters | |
---|---|
targetStateFrom | Target state to transition from. Equal to currentTargetState(). |
targetStateTo | Target state to transition to |
drawStatesFrom | Draw states to transition from. Equal to currentDrawStates() |
drawStatesTo | Draw states to transition to |
Implementation for transition(), which is called from AbstractUserInterface::targetStateFrom
and targetStateTo
values are guaranteed to be one of the following combinations:
- RendererTargetState::
Initial to Draw. - Initial to Final. The
drawStatesTo
is guaranteed to be empty in this case. - Initial to Composite. Is guaranteed to be called only if RendererFeature::
Composite is supported. - Draw to Draw. Called only if the
drawStatesFrom
anddrawStatesTo
differ. - Draw to Composite. Is guaranteed to be called only if RendererFeature::
Composite is supported. - Draw to Final
- Composite to Draw. Is guaranteed to be called only if RendererFeature::
Composite is supported. - Final to Initial. Both
drawStatesFrom
anddrawStatesTo
are guaranteed to be empty in this case.
The Initial to Initial transition, while allowed in transition(), is effectively a no-op so it doesn't propagate here.
In each AbstractUserInterface::