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
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description void
bind()
Binds this IndexBufferObject for rendering with glDrawElements.void
dispose()
Disposes this IndexDatat and all its associated OpenGL resources.java.nio.ShortBuffer
getBuffer()
Deprecated.usegetBuffer(boolean)
insteadjava.nio.ShortBuffer
getBuffer(boolean forWriting)
Returns the underlying ShortBuffer for reading or writing.int
getNumIndices()
int
getNumMaxIndices()
void
invalidate()
Invalidates the IndexBufferObject so a new OpenGL buffer handle is created.void
setIndices(short[] indices, int offset, int count)
Sets the indices of this IndexBufferObject, discarding the old indices.void
setIndices(java.nio.ShortBuffer indices)
Copies the specified indices to the indices of this IndexBufferObject, discarding the old indices.void
unbind()
Unbinds this IndexBufferObject.void
updateIndices(int targetOffset, short[] 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 IndexBufferObject can store.
-
setIndices
void setIndices(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()
andunbind()
. The index data will be updated instantly.- Parameters:
indices
- the index dataoffset
- the offset to start copying the data fromcount
- the number of shorts to copy
-
setIndices
void setIndices(java.nio.ShortBuffer indices)
Copies the specified indices to the indices of this IndexBufferObject, discarding the old indices. Copying start at the currentBuffer.position()
of the specified buffer and copied theBuffer.remaining()
amount of indices. This can be called in between calls tobind()
andunbind()
. The index data will be updated instantly.- Parameters:
indices
- the index data to copy
-
updateIndices
void updateIndices(int targetOffset, short[] indices, int offset, int count)
Update (a portion of) the indices.- Parameters:
targetOffset
- offset in indices bufferindices
- the index dataoffset
- the offset to start copying the data fromcount
- the number of shorts to copy
-
getBuffer
@Deprecated java.nio.ShortBuffer getBuffer()
Deprecated.usegetBuffer(boolean)
insteadReturns the underlying ShortBuffer. If you modify the buffer contents they will be uploaded on the next call to
bind()
. If you need immediate uploading usesetIndices(short[], int, int)
.- Returns:
- the underlying short buffer.
-
getBuffer
java.nio.ShortBuffer getBuffer(boolean forWriting)
Returns the underlying ShortBuffer for reading or writing.- Parameters:
forWriting
- when true, the underlying buffer will be uploaded on the next call tobind()
. If you need immediate uploading usesetIndices(short[], int, int)
.- Returns:
- the underlying short buffer.
-
bind
void bind()
Binds this IndexBufferObject for rendering with glDrawElements.
-
unbind
void unbind()
Unbinds this IndexBufferObject.
-
invalidate
void invalidate()
Invalidates the IndexBufferObject 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 interfaceDisposable
-
-