Convenience class for working with OpenGL vertex arrays. It interleaves all data in the order you specified in the constructor
via VertexAttribute.
This class is not compatible with OpenGL 3+ core profiles. For this VertexBufferObjects are needed.
| Modifier and Type | Field and Description |
|---|---|
| pack-priv final VertexAttributes | |
| pack-priv final FloatBuffer | |
| pack-priv final ByteBuffer | |
| pack-priv boolean |
| Access | Constructor and Description |
|---|---|
| public | VertexArray(int
the maximum number of vertices numVertices, VertexAttribute... the attributes)VertexAttributesConstructs a new interleaved VertexArray |
| public | VertexArray(int
the maximum number of vertices numVertices, VertexAttributes the attributes)VertexAttributesConstructs a new interleaved VertexArray |
| Modifier and Type | Method and Description |
|---|---|
| public void | bind(final ShaderProgram shader)
Implements com. Binds this VertexData for rendering via glDrawArrays or glDrawElements. |
| public void | bind(final ShaderProgram shader, final int[] locations)
Implements com. Binds this VertexData for rendering via glDrawArrays or glDrawElements. |
| public void | dispose()
Implements com. Disposes this VertexData and all its associated OpenGL resources. |
| 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 | |
| public void | invalidate()
Implements com. Invalidates the VertexData if applicable. |
| public void | setVertices(float[] vertices, int offset, int count)
Implements com. Sets the vertices of this VertexData, discarding the old vertex data. |
| public void | unbind(ShaderProgram
the shader shader)Implements com. Unbinds this VertexBufferObject. |
| public void | unbind(ShaderProgram shader, int[] locations)
Implements com. Unbinds this VertexData. |
| public void | updateVertices(int targetOffset, float[] vertices, int sourceOffset, int count)
Implements com. Update (a portion of) the vertices. |
| attributes | back to summary |
|---|---|
| pack-priv final VertexAttributes attributes | |
| buffer | back to summary |
|---|---|
| pack-priv final FloatBuffer buffer | |
| byteBuffer | back to summary |
|---|---|
| pack-priv final ByteBuffer byteBuffer | |
| isBound | back to summary |
|---|---|
| pack-priv boolean isBound | |
| VertexArray | back to summary |
|---|---|
| public VertexArray(int numVertices, VertexAttribute... attributes) Constructs a new interleaved VertexArray
| |
| VertexArray | back to summary |
|---|---|
| public VertexArray(int numVertices, VertexAttributes attributes) Constructs a new interleaved VertexArray
| |
| bind | back to summary |
|---|---|
| public void bind(final ShaderProgram shader) Implements com. Doc from com. Binds this VertexData for rendering via glDrawArrays or glDrawElements.
| |
| bind | back to summary |
|---|---|
| public void bind(final ShaderProgram shader, final int[] locations) Implements com. Doc from com. Binds this VertexData for rendering via glDrawArrays or glDrawElements.
| |
| dispose | back to summary |
|---|---|
| public void dispose() Implements com. Doc from com. Disposes this VertexData and all its associated OpenGL resources.
| |
| 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.
| |
| getNumMaxVertices | back to summary |
|---|---|
| public int getNumMaxVertices() Implements com. | |
| getNumVertices | back to summary |
|---|---|
| public int getNumVertices() Implements com.
| |
| invalidate | back to summary |
|---|---|
| public void invalidate() Implements com. Doc from com. Invalidates the VertexData if applicable. Use this in case of a context loss.
| |
| setVertices | back to summary |
|---|---|
| public void setVertices(float[] vertices, int offset, int count) Implements com. Doc from com. Sets the vertices of this VertexData, 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.
| |
| unbind | back to summary |
|---|---|
| public void unbind(ShaderProgram shader) Implements com. Unbinds this VertexBufferObject.
| |
| unbind | back to summary |
|---|---|
| public void unbind(ShaderProgram shader, int[] locations) Implements com. Doc from com. Unbinds this VertexData.
| |
| updateVertices | back to summary |
|---|---|
| public void updateVertices(int targetOffset, float[] vertices, int sourceOffset, int count) Implements com. Doc from com. Update (a portion of) the vertices. Does not resize the backing buffer.
| |