Interface IndexData

All Superinterfaces:
Disposable
All Known Implementing Classes:
IndexArray, IndexBufferObject, IndexBufferObjectSubData

public interface IndexData extends Disposable
An IndexData instance holds index data. Can be either a plain short buffer or an OpenGL buffer object.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Binds this IndexBufferObject for rendering with glDrawElements.
    Returns the underlying ShortBuffer.
    void
    Disposes this IndexData and all its associated OpenGL resources.
    int
    max()
     
    void
    set(short[] indices, int offset, int count)
    Sets the indices of this IndexBufferObject, discarding the old indices.
    void
    set(ShortBuffer indices)
    Copies the specified indices to the indices of this IndexBufferObject, discarding the old indices.
    int
     
    void
    Unbinds this IndexBufferObject.
    void
    update(int targetOffset, short[] indices, int offset, int count)
    Update (a portion of) the indices.

    Methods inherited from interface arc.util.Disposable

    isDisposed
  • Method Details

    • size

      int size()
      Returns:
      the number of indices currently stored in this buffer
    • max

      int max()
      Returns:
      the maximum number of indices this IndexBufferObject can store.
    • set

      void set(short[] indices, int offset, int count)

      Sets the indices of this IndexBufferObject, discarding the old indices. The count must equal the number of indices to be copied to this IndexBufferObject.

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

      Parameters:
      indices - the index data
      offset - the offset to start copying the data from
      count - the number of shorts to copy
    • set

      void set(ShortBuffer indices)
      Copies the specified indices to the indices of this IndexBufferObject, discarding the old indices. Copying start at the current Buffer.position() of the specified buffer and copied the Buffer.remaining() amount of indices. This can be called in between calls to bind() and unbind(). The index data will be updated instantly.
      Parameters:
      indices - the index data to copy
    • update

      void update(int targetOffset, short[] indices, int offset, int count)
      Update (a portion of) the indices.
      Parameters:
      targetOffset - offset in indices buffer
      indices - the index data
      offset - the offset to start copying the data from
      count - the number of shorts to copy
    • buffer

      ShortBuffer buffer()

      Returns the underlying ShortBuffer. If you modify the buffer contents they wil be uploaded on the call to bind(). If you need immediate uploading use set(short[], int, int).

      Returns:
      the underlying short buffer.
    • bind

      void bind()
      Binds this IndexBufferObject for rendering with glDrawElements.
    • unbind

      void unbind()
      Unbinds this IndexBufferObject.
    • dispose

      void dispose()
      Disposes this IndexData and all its associated OpenGL resources.
      Specified by:
      dispose in interface Disposable