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 TypeMethodDescriptionvoidapplyLocalOrigin(ILcdGLDrawable aGLDrawable, ILspView aView, ILcdPoint aPoint) Applies the given point as the local origin.voiddispose(ILcdGLDrawable aGLDrawable) Disposes this vertex array renderer.voidinit(ILcdGLDrawable aGLDrawable) Initializes this vertex array renderer.voidpopGLState(ILcdGLDrawable aGLDrawable) Removes the last pushed state from the stack.voidpushGLState(ILcdGLDrawable aGLDrawable, ILspGLState aGLState) Pushes a state object on stack.voidrestoreLocalOrigin(ILcdGLDrawable aGLDrawable, ILspView aView, ILcdPoint aPoint) Restores a previously set local origin.voidsubmitVertexArray(ILcdGLDrawable aGLDrawable, ILspView aView, ILspVertexArray aArray) Submits a vertex array to be rendered with the sequence of states pushed using thepushGLStatemethod.
-
Method Details
-
init
Initializes this vertex array renderer.- Parameters:
aGLDrawable- theILcdGLDrawablein which the objects are to be initialized
-
dispose
Disposes this vertex array renderer.- Parameters:
aGLDrawable- theILcdGLDrawablein 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 submittedpopGLStateshould 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. EverypushGLStatecall should be accompanied with one matchingpopGLStatecall.- 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 thepushGLStatemethod.- Parameters:
aGLDrawable- the drawable that is painted onaView- the viewaArray- the array to be rendered- Throws:
IllegalArgumentException- ifaArrayhas 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. InsteadaPointwill 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
-