Interface IntIndexData

  • All Superinterfaces:
    com.badlogic.gdx.utils.Disposable
    All Known Implementing Classes:
    IntIndexArray, IntIndexBufferObject, IntIndexBufferObjectSubData

    public interface IntIndexData
    extends com.badlogic.gdx.utils.Disposable
    An IntIndexData instance holds index data. Can be either a plain int buffer or an OpenGL buffer object. Reimplementation using 32-bit integer indices instead of shorts.
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      void bind()
      Binds this IntIndexBufferObject for rendering with glDrawElements.
      void dispose()
      Disposes this IndexDatat and all its associated OpenGL resources.
      java.nio.IntBuffer getBuffer()
      Returns the underlying IntBuffer.
      int getNumIndices()  
      int getNumMaxIndices()  
      void invalidate()
      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 setIndices​(java.nio.IntBuffer indices)
      Copies the specified indices to the indices of this IntIndexBufferObject, discarding the old indices.
      void unbind()
      Unbinds this IntIndexBufferObject.
      void updateIndices​(int targetOffset, int[] indices, int offset, int count)
      Update (a portion of) the indices.
    • Method Detail

      • getNumIndices

        int getNumIndices()
        Returns:
        the number of indices currently stored in this buffer
      • getNumMaxIndices

        int getNumMaxIndices()
        Returns:
        the maximum number of indices this IntIndexBufferObject can store.
      • setIndices

        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.

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

        void setIndices​(java.nio.IntBuffer indices)
        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 bind() and unbind(). The index data will be updated instantly.
        Parameters:
        indices - the index data to copy
      • updateIndices

        void updateIndices​(int targetOffset,
                           int[] 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 ints to copy
      • getBuffer

        java.nio.IntBuffer getBuffer()

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

        Returns:
        the underlying int buffer.
      • bind

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

        void unbind()
        Unbinds this IntIndexBufferObject.
      • invalidate

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

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