VertexBufferObject class. Sets the glVertexAttribDivisor for every VertexAttribute
automatically.
| Modifier and Type | Field and Description |
|---|---|
| private VertexAttributes | |
| private FloatBuffer | |
| private int | |
| private ByteBuffer | |
| pack-priv boolean | |
| pack-priv boolean | |
| private boolean | |
| private int |
| Access | Constructor and Description |
|---|---|
| public | |
| public |
| Modifier and Type | Method and Description |
|---|---|
| public void | bind(ShaderProgram
the shader shader)Implements com. Binds this InstanceBufferObject for rendering via glDrawArraysInstanced or glDrawElementsInstanced |
| public void | bind(ShaderProgram shader, int[] locations)
Implements com. Binds this InstanceData for rendering via glDrawArraysInstanced or glDrawElementsInstanced. |
| private void | |
| public void | dispose()
Implements com. Disposes of all resources this InstanceBufferObject uses. |
| public VertexAttributes | |
| public FloatBuffer | getBuffer()
Implements com.
Deprecated
use
getBuffer(boolean) instead
Returns the underlying FloatBuffer and marks it as dirty, causing the buffer contents to be uploaded on the next call to bind. |
| public FloatBuffer | getBuffer(boolean forWriting)
Implements com. Returns the underlying FloatBuffer for reading or writing. |
| public int | |
| public int | |
| protected int | getUsage()
Returns: The GL enum used in the call to |
| public void | invalidate()
Implements com. Invalidates the InstanceBufferObject so a new OpenGL buffer handle is created. |
| protected void | setBuffer(Buffer data, boolean ownsBuffer, VertexAttributes value)
Low level method to reset the buffer and attributes to the specified values. |
| public void | setInstanceData(float[] data, int offset, int count)
Implements com. Sets the vertices of this InstanceData, discarding the old vertex data. |
| public void | setInstanceData(FloatBuffer data, int count)
Implements com. Sets the vertices of this InstanceData, discarding the old vertex data. |
| protected void | setUsage(int value)
Set the GL enum used in the call to |
| public void | unbind(final ShaderProgram
the shader shader)Implements com. Unbinds this InstanceBufferObject. |
| public void | unbind(final ShaderProgram shader, final int[] locations)
Implements com. Unbinds this InstanceData. |
| public void | updateInstanceData(int targetOffset, float[] data, int sourceOffset, int count)
Implements com. Update (a portion of) the vertices. |
| public void | updateInstanceData(int targetOffset, FloatBuffer data, int sourceOffset, int count)
Implements com. Update (a portion of) the vertices. |
| attributes | back to summary |
|---|---|
| private VertexAttributes attributes | |
| buffer | back to summary |
|---|---|
| private FloatBuffer buffer | |
| bufferHandle | back to summary |
|---|---|
| private int bufferHandle | |
| byteBuffer | back to summary |
|---|---|
| private ByteBuffer byteBuffer | |
| isBound | back to summary |
|---|---|
| pack-priv boolean isBound | |
| isDirty | back to summary |
|---|---|
| pack-priv boolean isDirty | |
| ownsBuffer | back to summary |
|---|---|
| private boolean ownsBuffer | |
| usage | back to summary |
|---|---|
| private int usage | |
| InstanceBufferObject | back to summary |
|---|---|
| public InstanceBufferObject(boolean isStatic, int numVertices, VertexAttribute... attributes) | |
| InstanceBufferObject | back to summary |
|---|---|
| public InstanceBufferObject(boolean isStatic, int numVertices, VertexAttributes instanceAttributes) | |
| bind | back to summary |
|---|---|
| public void bind(ShaderProgram shader) Implements com. Binds this InstanceBufferObject for rendering via glDrawArraysInstanced or glDrawElementsInstanced
| |
| bind | back to summary |
|---|---|
| public void bind(ShaderProgram shader, int[] locations) Implements com. Doc from com. Binds this InstanceData for rendering via glDrawArraysInstanced or glDrawElementsInstanced.
| |
| bufferChanged | back to summary |
|---|---|
| private void bufferChanged() | |
| dispose | back to summary |
|---|---|
| public void dispose() Implements com. Disposes of all resources this InstanceBufferObject uses.
| |
| getAttributes | back to summary |
|---|---|
| public VertexAttributes getAttributes() Implements com.
| |
| getBuffer | back to summary |
|---|---|
| public FloatBuffer getBuffer() Implements com. Doc from com. Deprecated use Returns the underlying FloatBuffer and marks it as dirty, causing the buffer contents to be uploaded on the next call to
bind. If you need immediate uploading use
| |
| getBuffer | back to summary |
|---|---|
| public FloatBuffer getBuffer(boolean forWriting) Implements com. Doc from com. Returns the underlying FloatBuffer for reading or writing.
| |
| getNumInstances | back to summary |
|---|---|
| public int getNumInstances() Implements com.
| |
| getNumMaxInstances | back to summary |
|---|---|
| public int getNumMaxInstances() Implements com.
| |
| getUsage | back to summary |
|---|---|
protected int getUsage()
| |
| invalidate | back to summary |
|---|---|
| public void invalidate() Implements com. Invalidates the InstanceBufferObject so a new OpenGL buffer handle is created. Use this in case of a context loss.
| |
| setBuffer | back to summary |
|---|---|
| protected void setBuffer(Buffer data, boolean ownsBuffer, VertexAttributes value) Low level method to reset the buffer and attributes to the specified values. Use with care! | |
| setInstanceData | back to summary |
|---|---|
| public void setInstanceData(float[] data, int offset, int count) Implements com. Doc from com. Sets the vertices of this InstanceData, discarding the old vertex data. The count must equal the number of floats per
vertex times the number of vertices to be copied to this VertexData. The order of the vertex attributes must be the same as
specified at construction time via This can be called in between calls to bind and unbind. The vertex data will be updated instantly.
| |
| setInstanceData | back to summary |
|---|---|
| public void setInstanceData(FloatBuffer data, int count) Implements com. Doc from com. Sets the vertices of this InstanceData, discarding the old vertex data. The count must equal the number of floats per
vertex times the number of vertices to be copied to this InstanceData. The order of the vertex attributes must be the same
as specified at construction time via This can be called in between calls to bind and unbind. The vertex data will be updated instantly.
| |
| setUsage | back to summary |
|---|---|
| protected void setUsage(int value) Set the GL enum used in the call to | |
| unbind | back to summary |
|---|---|
| public void unbind(final ShaderProgram shader) Implements com. Unbinds this InstanceBufferObject.
| |
| unbind | back to summary |
|---|---|
| public void unbind(final ShaderProgram shader, final int[] locations) Implements com. Doc from com. Unbinds this InstanceData.
| |
| updateInstanceData | back to summary |
|---|---|
| public void updateInstanceData(int targetOffset, float[] data, int sourceOffset, int count) Implements com. Doc from com. Update (a portion of) the vertices. Does not resize the backing buffer.
| |
| updateInstanceData | back to summary |
|---|---|
| public void updateInstanceData(int targetOffset, FloatBuffer data, int sourceOffset, int count) Implements com. Doc from com. Update (a portion of) the vertices. Does not resize the backing buffer.
| |