IndexBufferObject wraps OpenGL's index buffer functionality to be used in conjunction with VBOs.
You can also use this to store indices for vertex arrays. Do not call bind() or unbind() in this case but
rather use getBuffer() to use the buffer directly with glDrawElements. You must also create the IndexBufferObject with
the second constructor and specify isDirect as true as glDrawElements in conjunction with vertex arrays needs direct buffers.
VertexBufferObjects must be disposed via the dispose() method when no longer needed
| Modifier and Type | Field and Description |
|---|---|
| pack-priv final ShortBuffer | |
| pack-priv int | |
| pack-priv final ByteBuffer | |
| pack-priv boolean | |
| pack-priv final boolean | |
| pack-priv boolean | |
| pack-priv final int |
| Access | Constructor and Description |
|---|---|
| public | IndexBufferObjectSubData(boolean
whether the index buffer is static isStatic, int the maximum number of indices this buffer can hold maxIndices)Creates a new IndexBufferObject. |
| public | IndexBufferObjectSubData(int
the maximum number of indices this buffer can hold maxIndices)Creates a new IndexBufferObject to be used with vertex arrays. |
| Modifier and Type | Method and Description |
|---|---|
| public void | bind()
Implements com. Binds this IndexBufferObject for rendering with glDrawElements. |
| private int | |
| public void | dispose()
Implements com. Disposes this IndexBufferObject and all its associated OpenGL resources. |
| public ShortBuffer | getBuffer()
Implements com.
Deprecated
use
getBuffer(boolean) instead
Returns the underlying ShortBuffer. |
| public ShortBuffer | getBuffer(boolean forWriting)
Implements com. Returns the underlying ShortBuffer for reading or writing. |
| public int | getNumIndices()
Implements com. Returns: the number of indices currently stored in this buffer |
| public int | getNumMaxIndices()
Implements com. Returns: the maximum number of indices this IndexBufferObject can store. |
| public void | invalidate()
Implements com. Invalidates the IndexBufferObject so a new OpenGL buffer handle is created. |
| public void | setIndices(short[]
the vertex data indices, int the offset to start copying the data from offset, int the number of floats to copy count)Implements com. Sets the indices of this IndexBufferObject, discarding the old indices. |
| public void | setIndices(ShortBuffer indices)
Implements com. Copies the specified indices to the indices of this IndexBufferObject, discarding the old indices. |
| public void | unbind()
Implements com. Unbinds this IndexBufferObject. |
| public void | updateIndices(int targetOffset, short[] indices, int offset, int count)
Implements com. Update (a portion of) the indices. |
| buffer | back to summary |
|---|---|
| pack-priv final ShortBuffer buffer | |
| bufferHandle | back to summary |
|---|---|
| pack-priv int bufferHandle | |
| byteBuffer | back to summary |
|---|---|
| pack-priv final ByteBuffer byteBuffer | |
| isBound | back to summary |
|---|---|
| pack-priv boolean isBound | |
| isDirect | back to summary |
|---|---|
| pack-priv final boolean isDirect | |
| isDirty | back to summary |
|---|---|
| pack-priv boolean isDirty | |
| usage | back to summary |
|---|---|
| pack-priv final int usage | |
| IndexBufferObjectSubData | back to summary |
|---|---|
| public IndexBufferObjectSubData(boolean isStatic, int maxIndices) Creates a new IndexBufferObject.
| |
| IndexBufferObjectSubData | back to summary |
|---|---|
| public IndexBufferObjectSubData(int maxIndices) Creates a new IndexBufferObject to be used with vertex arrays.
| |
| bind | back to summary |
|---|---|
| public void bind() Implements com. Binds this IndexBufferObject for rendering with glDrawElements. | |
| createBufferObject | back to summary |
|---|---|
| private int createBufferObject() | |
| dispose | back to summary |
|---|---|
| public void dispose() Implements com. Disposes this IndexBufferObject and all its associated OpenGL resources. | |
| getBuffer | back to summary |
|---|---|
| public ShortBuffer getBuffer() Implements com. Doc from com. Deprecated use
Returns the underlying ShortBuffer. If you modify the buffer contents they will be uploaded on the next call to
| |
| getBuffer | back to summary |
|---|---|
| public ShortBuffer getBuffer(boolean forWriting) Implements com. Doc from com. Returns the underlying ShortBuffer for reading or writing.
| |
| getNumIndices | back to summary |
|---|---|
| public int getNumIndices() Implements com.
| |
| getNumMaxIndices | back to summary |
|---|---|
| public int getNumMaxIndices() Implements com.
| |
| invalidate | back to summary |
|---|---|
| public void invalidate() Implements com. Invalidates the IndexBufferObject so a new OpenGL buffer handle is created. Use this in case of a context loss. | |
| setIndices | back to summary |
|---|---|
| public void setIndices(short[] indices, int offset, int count) Implements com. 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
| |
| setIndices | back to summary |
|---|---|
| public void setIndices(ShortBuffer indices) Implements com. Doc from com. Copies the specified indices to the indices of this IndexBufferObject, discarding the old indices. Copying start at the
current | |
| unbind | back to summary |
|---|---|
| public void unbind() Implements com. Unbinds this IndexBufferObject. | |
| updateIndices | back to summary |
|---|---|
| public void updateIndices(int targetOffset, short[] indices, int offset, int count) Implements com. Doc from com. Update (a portion of) the indices.
| |