Class IntIndexBufferObjectSubData

java.lang.Object
gaiasky.util.gdx.mesh.IntIndexBufferObjectSubData
All Implemented Interfaces:
com.badlogic.gdx.utils.Disposable, IntIndexData

public class IntIndexBufferObjectSubData extends Object implements IntIndexData
  • Constructor Summary

    Constructors
    Constructor
    Description
    IntIndexBufferObjectSubData(boolean isStatic, int maxIndices)
    Creates a new IntIndexBufferObject.
    Creates a new IntIndexBufferObject to be used with vertex arrays.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Binds this IntIndexBufferObject for rendering with glDrawElements.
    void
    Disposes this IntIndexBufferObject and all its associated OpenGL resources.
    Returns the underlying IntBuffer.
    int
     
    int
     
    void
    Invalidates the IntIndexBufferObject so a new OpenGL buffer handle is created.
    void
    setIndices(int[] indices, int offset, int count)
    Sets the indices of this IntIndexBufferObject, discarding the old indices.
    void
    Copies the specified indices to the indices of this IntIndexBufferObject, discarding the old indices.
    void
    Unbinds this IntIndexBufferObject.
    void
    updateIndices(int targetOffset, int[] indices, int offset, int count)
    Update (a portion of) the indices.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • IntIndexBufferObjectSubData

      public IntIndexBufferObjectSubData(boolean isStatic, int maxIndices)
      Creates a new IntIndexBufferObject.
      Parameters:
      isStatic - whether the index buffer is static
      maxIndices - the maximum number of indices this buffer can hold
    • IntIndexBufferObjectSubData

      public IntIndexBufferObjectSubData(int maxIndices)
      Creates a new IntIndexBufferObject to be used with vertex arrays.
      Parameters:
      maxIndices - the maximum number of indices this buffer can hold
  • Method Details

    • getNumIndices

      public int getNumIndices()
      Specified by:
      getNumIndices in interface IntIndexData
      Returns:
      the number of indices currently stored in this buffer
    • getNumMaxIndices

      public int getNumMaxIndices()
      Specified by:
      getNumMaxIndices in interface IntIndexData
      Returns:
      the maximum number of indices this IntIndexBufferObject can store.
    • setIndices

      public void setIndices(int[] indices, int offset, int count)

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

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

      Specified by:
      setIndices in interface IntIndexData
      Parameters:
      indices - the vertex data
      offset - the offset to start copying the data from
      count - the number of floats to copy
    • setIndices

      public void setIndices(IntBuffer indices)
      Description copied from interface: IntIndexData
      Copies the specified indices to the indices of this IntIndexBufferObject, 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 IntIndexData.bind() and IntIndexData.unbind(). The index data will be updated instantly.
      Specified by:
      setIndices in interface IntIndexData
      Parameters:
      indices - the index data to copy
    • updateIndices

      public void updateIndices(int targetOffset, int[] indices, int offset, int count)
      Description copied from interface: IntIndexData
      Update (a portion of) the indices.
      Specified by:
      updateIndices in interface IntIndexData
      Parameters:
      targetOffset - offset in indices buffer
      indices - the index data
      offset - the offset to start copying the data from
      count - the number of ints to copy
    • getBuffer

      public IntBuffer getBuffer()

      Returns the underlying IntBuffer. If you modify the buffer contents they will be uploaded on the call to bind(). If you need immediate uploading use setIndices(int[], int, int).

      Specified by:
      getBuffer in interface IntIndexData
      Returns:
      the underlying int buffer.
    • bind

      public void bind()
      Binds this IntIndexBufferObject for rendering with glDrawElements.
      Specified by:
      bind in interface IntIndexData
    • unbind

      public void unbind()
      Unbinds this IntIndexBufferObject.
      Specified by:
      unbind in interface IntIndexData
    • invalidate

      public void invalidate()
      Invalidates the IntIndexBufferObject so a new OpenGL buffer handle is created. Use this in case of a context loss.
      Specified by:
      invalidate in interface IntIndexData
    • dispose

      public void dispose()
      Disposes this IntIndexBufferObject and all its associated OpenGL resources.
      Specified by:
      dispose in interface com.badlogic.gdx.utils.Disposable
      Specified by:
      dispose in interface IntIndexData