Package arc.graphics.gl
Interface VertexData
- All Superinterfaces:
Disposable
- All Known Implementing Classes:
VertexArray
,VertexBufferObject
,VertexBufferObjectWithVAO
A VertexData instance holds vertices for rendering with OpenGL.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Binds this VertexData for rendering via glDrawArrays or glDrawElements.buffer()
Returns the underlying FloatBuffer and marks it as dirty, causing the buffer contents to be uploaded on the next call to bind.int
max()
default void
void
set
(float[] vertices, int offset, int count) Sets the vertices of this VertexData, discarding the old vertex data.int
size()
void
Unbinds this VertexData.void
update
(int targetOffset, float[] vertices, int sourceOffset, int count) Update (a portion of) the vertices.Methods inherited from interface arc.util.Disposable
dispose, isDisposed
-
Method Details
-
render
-
size
int size()- Returns:
- the number of vertices this VertexData stores
-
max
int max()- Returns:
- the number of vertices this VertexData can store
-
set
void set(float[] vertices, int offset, int count) 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.This can be called in between calls to bind and unbind. The vertex data will be updated instantly.
- Parameters:
vertices
- the vertex dataoffset
- the offset to start copying the data fromcount
- the number of floats to copy
-
update
void update(int targetOffset, float[] vertices, int sourceOffset, int count) Update (a portion of) the vertices. Does not resize the backing buffer.- Parameters:
vertices
- the vertex datasourceOffset
- the offset to start copying the data fromcount
- the number of floats to copy
-
buffer
FloatBuffer buffer()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 useset(float[], int, int)
; Any modifications made to the Buffer *after* the call to bind will not automatically be uploaded.- Returns:
- the underlying FloatBuffer holding the vertex data.
-
bind
Binds this VertexData for rendering via glDrawArrays or glDrawElements. -
unbind
Unbinds this VertexData.
-