Interface ILspVertexArrayRenderer
public interface ILspVertexArrayRenderer
A centralized manager for vertex array rendering. Painters can submit
ILspVertexArray
instances to the vertex array renderer to have them rendered
at some point in the future. The vertex array renderer can attempt to render
the arrays as efficiently as possible, for instance by grouping them or by
storing them in GPU memory.
Submitting a vertex array for rendering is done by pushing a sequence of
states on the stack using the pushGLState
method followed by
submitting the vertex array itself using the submitVertexArray
method.
After all vertex arrays are submitted,
an equal number of popGLState
calls should be performed to
restore the stack's initial state.
This push/pop mechanism allows nesting of states and enables implementing
classes to efficiently combine equal states and avoid the overhead
of switching context for every single vertex array submitted.
If high accuracy is required, it is advised to use double precision for
POSITION
vertex attributes, with a NULL
local origin. In this case
it is assumed that all positions are defined in the view's world reference.
Double precision is not supported for other attributes.
- Since:
- 2012.0
-
Method Summary
Modifier and TypeMethodDescriptionvoid
applyLocalOrigin
(ILcdGLDrawable aGLDrawable, ILspView aView, ILcdPoint aPoint) Applies the given point as the local origin.void
dispose
(ILcdGLDrawable aGLDrawable) Disposes this vertex array renderer.void
init
(ILcdGLDrawable aGLDrawable) Initializes this vertex array renderer.void
popGLState
(ILcdGLDrawable aGLDrawable) Removes the last pushed state from the stack.void
pushGLState
(ILcdGLDrawable aGLDrawable, ILspGLState aGLState) Pushes a state object on stack.void
restoreLocalOrigin
(ILcdGLDrawable aGLDrawable, ILspView aView, ILcdPoint aPoint) Restores a previously set local origin.void
submitVertexArray
(ILcdGLDrawable aGLDrawable, ILspView aView, ILspVertexArray aArray) Submits a vertex array to be rendered with the sequence of states pushed using thepushGLState
method.
-
Method Details
-
init
Initializes this vertex array renderer.- Parameters:
aGLDrawable
- theILcdGLDrawable
in which the objects are to be initialized
-
dispose
Disposes this vertex array renderer.- Parameters:
aGLDrawable
- theILcdGLDrawable
in which the objects are to be disposed
-
pushGLState
Pushes a state object on stack. All subsequent submitted vertex arrays will be rendered with this state enabled. States can be nested by performing multiple pushes before submitting a vertex array. After all vertex arrays are submittedpopGLState
should be called to remove the render group from the stack.- Parameters:
aGLDrawable
- the drawable that is painted onaGLState
- the state object
-
popGLState
Removes the last pushed state from the stack. EverypushGLState
call should be accompanied with one matchingpopGLState
call.- Parameters:
aGLDrawable
- the drawable that is painted on- Throws:
IllegalStateException
- when there is nothing to pop from the stack
-
submitVertexArray
Submits a vertex array to be rendered with the sequence of states pushed using thepushGLState
method.- Parameters:
aGLDrawable
- the drawable that is painted onaView
- the viewaArray
- the array to be rendered- Throws:
IllegalArgumentException
- ifaArray
has double precision vertex attributes for attributes other thanPOSITION
-
applyLocalOrigin
Applies the given point as the local origin. All vertex arrays' own local origins that are submitted will be ignored. InsteadaPoint
will be used as local origin instead.Setting an explicit local origin also disables the automatic local origin allocation.
- Parameters:
aGLDrawable
- the drawable that is painted onaView
- the view that is painted inaPoint
- the local origin to apply
-
restoreLocalOrigin
Restores a previously set local origin.- Parameters:
aGLDrawable
- the drawable that is painted onaView
- the view that is painted inaPoint
- the local origin that was applied
-