APIdia Launch Partner
Top Description Methods
com.badlogic.gdx.graphics.glutils

public Interface IndexData

extends Disposable
Known Direct Implementers
com.badlogic.gdx.graphics.glutils.IndexBufferObject, com.badlogic.gdx.graphics.glutils.IndexArray, com.badlogic.gdx.graphics.glutils.IndexBufferObjectSubData
Imports
java.nio.ShortBuffer, com.badlogic.gdx.utils.Disposable

An IndexData instance holds index data. Can be either a plain short buffer or an OpenGL buffer object.
Author
mzechner

Method Summary

Modifier and TypeMethod and Description
public void
bind()

Binds this IndexBufferObject for rendering with glDrawElements.

public void
dispose()

Redeclares com.badlogic.gdx.utils.Disposable.dispose.

Disposes this IndexDatat and all its associated OpenGL resources.

public ShortBuffer

Returns:

the underlying short buffer.
getBuffer
()
Deprecated use getBuffer(boolean) instead

Returns the underlying ShortBuffer.

public ShortBuffer

Returns:

the underlying short buffer.
getBuffer
(boolean
when true, the underlying buffer will be uploaded on the next call to bind(). If you need immediate uploading use setIndices(short[], int, int).
forWriting
)

Returns the underlying ShortBuffer for reading or writing.

public int
getNumIndices()

Returns: the number of indices currently stored in this buffer

public int
getNumMaxIndices()

Returns: the maximum number of indices this IndexBufferObject can store.

public void
invalidate()

Invalidates the IndexBufferObject so a new OpenGL buffer handle is created.

public void
setIndices(short[]
the index data
indices
,
int
the offset to start copying the data from
offset
,
int
the number of shorts to copy
count
)

Sets the indices of this IndexBufferObject, discarding the old indices.

public void
setIndices(ShortBuffer
the index data to copy
indices
)

Copies the specified indices to the indices of this IndexBufferObject, discarding the old indices.

public void
unbind()

Unbinds this IndexBufferObject.

public void
updateIndices(int
offset in indices buffer
targetOffset
,
short[]
the index data
indices
,
int
the offset to start copying the data from
offset
,
int
the number of shorts to copy
count
)

Update (a portion of) the indices.

Method Detail

bindback to summary
public void bind()

Binds this IndexBufferObject for rendering with glDrawElements.

disposeback to summary
public void dispose()

Redeclares com.badlogic.gdx.utils.Disposable.dispose.

Disposes this IndexDatat and all its associated OpenGL resources.

getBufferback to summary
public ShortBuffer getBuffer()

Deprecated

use getBuffer(boolean) instead

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

Returns:ShortBuffer

the underlying short buffer.

Annotations
@Deprecated
getBufferback to summary
public ShortBuffer getBuffer(boolean forWriting)

Returns the underlying ShortBuffer for reading or writing.

Parameters
forWriting:boolean

when true, the underlying buffer will be uploaded on the next call to bind(). If you need immediate uploading use setIndices(short[], int, int).

Returns:ShortBuffer

the underlying short buffer.

getNumIndicesback to summary
public int getNumIndices()
Returns:int

the number of indices currently stored in this buffer

getNumMaxIndicesback to summary
public int getNumMaxIndices()
Returns:int

the maximum number of indices this IndexBufferObject can store.

invalidateback to summary
public void invalidate()

Invalidates the IndexBufferObject so a new OpenGL buffer handle is created. Use this in case of a context loss.

setIndicesback to summary
public 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() and unbind(). The index data will be updated instantly.

Parameters
indices:short[]

the index data

offset:int

the offset to start copying the data from

count:int

the number of shorts to copy

setIndicesback to summary
public void setIndices(ShortBuffer indices)

Copies the specified indices to the indices of this IndexBufferObject, discarding the old indices. Copying start at the current ShortBuffer#position() of the specified buffer and copied the ShortBuffer#remaining() amount of indices. This can be called in between calls to bind() and unbind(). The index data will be updated instantly.

Parameters
indices:ShortBuffer

the index data to copy

unbindback to summary
public void unbind()

Unbinds this IndexBufferObject.

updateIndicesback to summary
public void updateIndices(int targetOffset, short[] indices, int offset, int count)

Update (a portion of) the indices.

Parameters
targetOffset:int

offset in indices buffer

indices:short[]

the index data

offset:int

the offset to start copying the data from

count:int

the number of shorts to copy