APIdia Launch Partner
Top Fields Constructors Methods
com.badlogic.gdx.graphics.glutils

public Class IndexArray

extends Object
implements IndexData
Class Inheritance
All Implemented Interfaces
com.badlogic.gdx.graphics.glutils.IndexData, com.badlogic.gdx.utils.Disposable
Imports
java.nio.Buffer, .ByteBuffer, .ShortBuffer, com.badlogic.gdx.utils.BufferUtils

Field Summary

Modifier and TypeField and Description
pack-priv final ShortBuffer
pack-priv final ByteBuffer
private final boolean

Constructor Summary

AccessConstructor and Description
public
IndexArray(int
the maximum number of indices this buffer can hold
maxIndices
)

Creates a new IndexArray to be used with vertex arrays.

Method Summary

Modifier and TypeMethod and Description
public void
bind()

Implements com.badlogic.gdx.graphics.glutils.IndexData.bind.

Binds this IndexArray for rendering with glDrawElements.

public void
dispose()

Implements com.badlogic.gdx.graphics.glutils.IndexData.dispose.

Disposes this IndexArray and all its associated OpenGL resources.

public ShortBuffer
getBuffer()

Implements com.badlogic.gdx.graphics.glutils.IndexData.getBuffer.

Deprecated use getBuffer(boolean) instead

Returns the underlying ShortBuffer.

public ShortBuffer
getBuffer(boolean forWriting)

Implements com.badlogic.gdx.graphics.glutils.IndexData.getBuffer.

Returns the underlying ShortBuffer for reading or writing.

public int
getNumIndices()

Implements com.badlogic.gdx.graphics.glutils.IndexData.getNumIndices.

Returns: the number of indices currently stored in this buffer

public int
getNumMaxIndices()

Implements com.badlogic.gdx.graphics.glutils.IndexData.getNumMaxIndices.

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

public void
invalidate()

Implements com.badlogic.gdx.graphics.glutils.IndexData.invalidate.

Invalidates the IndexArray 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 shorts to copy
count
)

Implements com.badlogic.gdx.graphics.glutils.IndexData.setIndices.

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

public void
setIndices(ShortBuffer indices)

Implements com.badlogic.gdx.graphics.glutils.IndexData.setIndices.

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

public void
unbind()

Implements com.badlogic.gdx.graphics.glutils.IndexData.unbind.

Unbinds this IndexArray.

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

Implements com.badlogic.gdx.graphics.glutils.IndexData.updateIndices.

Update (a portion of) the indices.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

bufferback to summary
pack-priv final ShortBuffer buffer
byteBufferback to summary
pack-priv final ByteBuffer byteBuffer
emptyback to summary
private final boolean empty

Constructor Detail

IndexArrayback to summary
public IndexArray(int maxIndices)

Creates a new IndexArray to be used with vertex arrays.

Parameters
maxIndices:int

the maximum number of indices this buffer can hold

Method Detail

bindback to summary
public void bind()

Implements com.badlogic.gdx.graphics.glutils.IndexData.bind.

Binds this IndexArray for rendering with glDrawElements.

disposeback to summary
public void dispose()

Implements com.badlogic.gdx.graphics.glutils.IndexData.dispose.

Disposes this IndexArray and all its associated OpenGL resources.

getBufferback to summary
public ShortBuffer getBuffer()

Implements com.badlogic.gdx.graphics.glutils.IndexData.getBuffer.

Doc from com.badlogic.gdx.graphics.glutils.IndexData.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).

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

Implements com.badlogic.gdx.graphics.glutils.IndexData.getBuffer.

Doc from com.badlogic.gdx.graphics.glutils.IndexData.getBuffer.

Returns the underlying ShortBuffer for reading or writing.

Annotations
@Override
getNumIndicesback to summary
public int getNumIndices()

Implements com.badlogic.gdx.graphics.glutils.IndexData.getNumIndices.

Returns:int

the number of indices currently stored in this buffer

getNumMaxIndicesback to summary
public int getNumMaxIndices()

Implements com.badlogic.gdx.graphics.glutils.IndexData.getNumMaxIndices.

Returns:int

the maximum number of indices this IndexArray can store.

invalidateback to summary
public void invalidate()

Implements com.badlogic.gdx.graphics.glutils.IndexData.invalidate.

Invalidates the IndexArray 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)

Implements com.badlogic.gdx.graphics.glutils.IndexData.setIndices.

Sets the indices of this IndexArray, discarding the old indices. The count must equal the number of indices to be copied to this IndexArray.

This can be called in between calls to bind() and unbind(). The index data will be updated instantly.

Parameters
indices:short[]

the vertex 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)

Implements com.badlogic.gdx.graphics.glutils.IndexData.setIndices.

Doc from com.badlogic.gdx.graphics.glutils.IndexData.setIndices.

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.

unbindback to summary
public void unbind()

Implements com.badlogic.gdx.graphics.glutils.IndexData.unbind.

Unbinds this IndexArray.

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

Implements com.badlogic.gdx.graphics.glutils.IndexData.updateIndices.

Doc from com.badlogic.gdx.graphics.glutils.IndexData.updateIndices.

Update (a portion of) the indices.

Annotations
@Override