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 Details

    • init

      void init(ILcdGLDrawable aGLDrawable)
      Initializes this vertex array renderer.
      Parameters:
      aGLDrawable - the ILcdGLDrawable in which the objects are to be initialized
    • dispose

      void dispose(ILcdGLDrawable aGLDrawable)
      Disposes this vertex array renderer.
      Parameters:
      aGLDrawable - the ILcdGLDrawable in which the objects are to be disposed
    • pushGLState

      void pushGLState(ILcdGLDrawable aGLDrawable, ILspGLState aGLState)
      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 submitted popGLState should be called to remove the render group from the stack.

      Parameters:
      aGLDrawable - the drawable that is painted on
      aGLState - the state object
    • popGLState

      void popGLState(ILcdGLDrawable aGLDrawable)
      Removes the last pushed state from the stack.

      Every pushGLState call should be accompanied with one matching popGLState call.

      Parameters:
      aGLDrawable - the drawable that is painted on
      Throws:
      IllegalStateException - when there is nothing to pop from the stack
    • submitVertexArray

      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.
      Parameters:
      aGLDrawable - the drawable that is painted on
      aView - the view
      aArray - the array to be rendered
      Throws:
      IllegalArgumentException - if aArray has double precision vertex attributes for attributes other than POSITION
    • applyLocalOrigin

      void applyLocalOrigin(ILcdGLDrawable aGLDrawable, ILspView aView, ILcdPoint aPoint)
      Applies the given point as the local origin. All vertex arrays' own local origins that are submitted will be ignored. Instead aPoint 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 on
      aView - the view that is painted in
      aPoint - the local origin to apply
    • restoreLocalOrigin

      void restoreLocalOrigin(ILcdGLDrawable aGLDrawable, ILspView aView, ILcdPoint aPoint)
      Restores a previously set local origin.
      Parameters:
      aGLDrawable - the drawable that is painted on
      aView - the view that is painted in
      aPoint - the local origin that was applied