public interface ILspVertexArrayRenderer
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.
Modifier and Type | Method and Description |
---|---|
void |
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 the
pushGLState method. |
void init(ILcdGLDrawable aGLDrawable)
aGLDrawable
- the ILcdGLDrawable
in which the objects are to be initializedvoid dispose(ILcdGLDrawable aGLDrawable)
aGLDrawable
- the ILcdGLDrawable
in which the objects are to be disposedvoid pushGLState(ILcdGLDrawable aGLDrawable, ILspGLState aGLState)
popGLState
should be called to remove
the render group from the stack.aGLDrawable
- the drawable that is painted onaGLState
- the state objectvoid popGLState(ILcdGLDrawable aGLDrawable)
pushGLState
call should be accompanied with one matching popGLState
call.aGLDrawable
- the drawable that is painted onIllegalStateException
- when there is nothing to pop from the stackvoid submitVertexArray(ILcdGLDrawable aGLDrawable, ILspView aView, ILspVertexArray aArray)
pushGLState
method.aGLDrawable
- the drawable that is painted onaView
- the viewaArray
- the array to be renderedIllegalArgumentException
- if aArray
has double precision vertex attributes for
attributes other than
POSITION
void applyLocalOrigin(ILcdGLDrawable aGLDrawable, ILspView aView, ILcdPoint aPoint)
aPoint
will be
used as local origin instead.
Setting an explicit local origin also disables the automatic local origin allocation.
aGLDrawable
- the drawable that is painted onaView
- the view that is painted inaPoint
- the local origin to applyvoid restoreLocalOrigin(ILcdGLDrawable aGLDrawable, ILspView aView, ILcdPoint aPoint)
aGLDrawable
- the drawable that is painted onaView
- the view that is painted inaPoint
- the local origin that was applied