Interface VertexData

All Superinterfaces:
Disposable
All Known Implementing Classes:
VertexArray, VertexBufferObject, VertexBufferObjectWithVAO

public interface VertexData extends Disposable
A VertexData instance holds vertices for rendering with OpenGL.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    bind(Shader shader)
    Binds this VertexData for rendering via glDrawArrays or glDrawElements.
    Returns the underlying FloatBuffer and marks it as dirty, causing the buffer contents to be uploaded on the next call to bind.
    int
    max()
     
    default void
    render(IndexData indices, int primitiveType, int offset, int count)
     
    void
    set(float[] vertices, int offset, int count)
    Sets the vertices of this VertexData, discarding the old vertex data.
    int
     
    void
    unbind(Shader shader)
    Unbinds this VertexData.
    void
    update(int targetOffset, float[] vertices, int sourceOffset, int count)
    Update (a portion of) the vertices.

    Methods inherited from interface arc.util.Disposable

    dispose, isDisposed
  • Method Details

    • render

      default void render(IndexData indices, int primitiveType, int offset, int count)
    • size

      int size()
      Returns:
      the number of vertices this VertexData stores
    • max

      int max()
      Returns:
      the number of vertices this VertexData can store
    • set

      void set(float[] vertices, int offset, int count)
      Sets the vertices of this VertexData, discarding the old vertex data. The count must equal the number of floats per vertex times the number of vertices to be copied to this VertexData.

      This can be called in between calls to bind and unbind. The vertex data will be updated instantly.

      Parameters:
      vertices - the vertex data
      offset - the offset to start copying the data from
      count - the number of floats to copy
    • update

      void update(int targetOffset, float[] vertices, int sourceOffset, int count)
      Update (a portion of) the vertices. Does not resize the backing buffer.
      Parameters:
      vertices - the vertex data
      sourceOffset - the offset to start copying the data from
      count - the number of floats to copy
    • buffer

      FloatBuffer buffer()
      Returns the underlying FloatBuffer and marks it as dirty, causing the buffer contents to be uploaded on the next call to bind. If you need immediate uploading use set(float[], int, int); Any modifications made to the Buffer *after* the call to bind will not automatically be uploaded.
      Returns:
      the underlying FloatBuffer holding the vertex data.
    • bind

      void bind(Shader shader)
      Binds this VertexData for rendering via glDrawArrays or glDrawElements.
    • unbind

      void unbind(Shader shader)
      Unbinds this VertexData.