|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.neovisionaries.android.opengl.VertexBuffer<TVertexBuffer>
public abstract class VertexBuffer<TVertexBuffer extends VertexBuffer<TVertexBuffer>>
OpenGL ES vertex buffer.
// E X A M P L E 1 // Create a vertex buffer.VertexBuffer
vb = newArrayBuffer
(); //VertexBuffer vb = newElementArrayBuffer
(); // Bind the vertex buffer. vb.bind
(); // Prepare data to set to the vertex buffer. Buffer data = ...; // Set the data to the vertex buffer. vb.setData
(data);
Constructor Summary | |
---|---|
protected |
VertexBuffer(VertexBufferType type)
A constructor with a vertex buffer type. |
Method Summary | |
---|---|
TVertexBuffer |
bind()
Bind this vertex buffer using glBindBuffer(). |
TVertexBuffer |
delete()
Delete the buffer object using glDeleteBuffers(). |
int |
getId()
Get the ID of the buffer object assigned to this instance. |
VertexBufferState |
getState()
Get the state of this vertex buffer. |
VertexBufferType |
getType()
Get the type of this vertex buffer. |
abstract boolean |
isBound()
Check if this vertex buffer is bound. |
TVertexBuffer |
setData(Buffer data)
This method calls setData (data, -1, null). |
TVertexBuffer |
setData(Buffer data,
int count)
This method calls setData (data, count, null). |
TVertexBuffer |
setData(Buffer data,
int count,
VertexBufferUsage usage)
Set data to this vertex buffer. |
TVertexBuffer |
setData(Buffer data,
VertexBufferUsage usage)
This method calls setData (data, -1, usage). |
TVertexBuffer |
setSubData(Buffer data)
This method calls setSubData (data, -1, 0). |
TVertexBuffer |
setSubData(Buffer data,
int count)
This method calls setSubData (data, count, 0). |
TVertexBuffer |
setSubData(Buffer data,
int count,
int offset)
Set sub data to this vertex buffer. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
protected VertexBuffer(VertexBufferType type) throws GLESException
VertexBufferState.CREATED
.
type
- VertexBufferType.ARRAY
or
VertexBufferType.ELEMENT_ARRAY
.
IllegalArgumentException
- The given argument is null.
GLESException
- glGenBuffers() failed.ArrayBuffer.ArrayBuffer()
,
ElementArrayBuffer.ElementArrayBuffer()
,
glGenBuffersMethod Detail |
---|
public VertexBufferType getType()
public int getId()
public VertexBufferState getState()
public TVertexBuffer bind()
IllegalStateException
- This vertex buffer has already been deleted.public TVertexBuffer delete()
VertexBufferState.DELETED
.
public TVertexBuffer setData(Buffer data, int count, VertexBufferUsage usage)
As a side effect, if this vertex buffer has not been bound yet,
bind()
is executed before glBufferData().
data
- Data to pass to glBufferData().count
- The number of elements to pass to glBufferData(). Note that
the unit is not 'bytes'. The size (in bytes) to pass to
glBufferData() is calculated in this method based on the
type of the given data. If 'count' is a negative value,
data.remaining() is used.usage
- Usage of the data. If null is given, VertexBufferUsage.STATIC
is used.
IllegalArgumentException
- 'data' is null, or 'count' exceeds data.remaining().public TVertexBuffer setData(Buffer data, VertexBufferUsage usage)
setData
(data, -1, usage).
data
- Data to pass to glBufferData().usage
- Usage of the data.
setData(Buffer, int, VertexBufferUsage)
public TVertexBuffer setData(Buffer data, int count)
setData
(data, count, null).
data
- Data to pass to glBufferData().count
- The number of elements to pass to glBufferData().
setData(Buffer, int, VertexBufferUsage)
public TVertexBuffer setData(Buffer data)
setData
(data, -1, null).
data
- Data to pass to glBufferData().
setData(Buffer, int, VertexBufferUsage)
public TVertexBuffer setSubData(Buffer data, int count, int offset)
data
- Data to pass to glBufferSubData().count
- The number of elements to pass to glBufferSubData().
Note that the unit is not 'bytes'. The size (in bytes)
to pass to glBufferSubData() is calculated in this
method based on the type of the given data. If 'count'
is a negative value, data.remaining() is used.offset
- The number of elements to skip. Note that the unit is
not 'bytes'. The offset (in bytes) to pass to
glBufferSubData() is calculated in this method based
on the type of the given data.
IllegalArgumentException
- 'data' is null, or 'count' exceeds data.remaining().public TVertexBuffer setSubData(Buffer data, int count)
setSubData
(data, count, 0).
data
- Data to pass to glBufferSubData().count
- The number of elements to pass to glBufferSubData().
setSubData(Buffer, int, int)
public TVertexBuffer setSubData(Buffer data)
setSubData
(data, -1, 0).
data
- Data to pass to glBufferSubData().
setSubData(Buffer, int, int)
public abstract boolean isBound()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |