Package arc.graphics.gl
Interface IndexData
- All Superinterfaces:
Disposable
- All Known Implementing Classes:
IndexArray
,IndexBufferObject
,IndexBufferObjectSubData
An IndexData instance holds index data. Can be either a plain short buffer or an OpenGL buffer object.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
bind()
Binds this IndexBufferObject for rendering with glDrawElements.buffer()
Returns the underlying ShortBuffer.void
dispose()
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
size()
void
unbind()
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()
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
-
set
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
-
update
void update(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
-
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 useset(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 interfaceDisposable
-