Package gaiasky.util.gdx.mesh
Interface IntVertexData
- All Superinterfaces:
com.badlogic.gdx.utils.Disposable
- All Known Implementing Classes:
VertexArray
,VertexBufferObject
,VertexBufferObjectInstanced
,VertexBufferObjectSubData
,VertexBufferObjectWithVAO
public interface IntVertexData
extends com.badlogic.gdx.utils.Disposable
A VertexData instance holds vertices for rendering with OpenGL. It is implemented as either a
VertexArray
or a
VertexBufferObject
. Only the later supports OpenGL ES 2.0.-
Method Summary
Modifier and TypeMethodDescriptionvoid
bind
(ExtShaderProgram shader) Binds this VertexData for rendering via glDrawArrays or glDrawElements.void
bind
(ExtShaderProgram shader, int[] locations) Binds this VertexData for rendering via glDrawArrays or glDrawElements.void
dispose()
Disposes this VertexData and all its associated OpenGL resources.com.badlogic.gdx.graphics.VertexAttributes
Returns the underlying FloatBuffer and marks it as dirty, causing the buffer contents to be uploaded on the next call to bind.int
int
void
Invalidates the VertexData if applicable.void
setVertices
(float[] vertices, int offset, int count) Sets the vertices of this VertexData, discarding the old vertex data.void
unbind
(ExtShaderProgram shader) Unbinds this VertexData.void
unbind
(ExtShaderProgram shader, int[] locations) Unbinds this VertexData.void
updateVertices
(int targetOffset, float[] vertices, int sourceOffset, int count) Update (a portion of) the vertices.
-
Method Details
-
getNumVertices
int getNumVertices()- Returns:
- the number of vertices this VertexData stores
-
getNumMaxVertices
int getNumMaxVertices()- Returns:
- the number of vertices this VertedData can store
-
getAttributes
com.badlogic.gdx.graphics.VertexAttributes getAttributes()- Returns:
- the
VertexAttributes
as specified during construction.
-
setVertices
void setVertices(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. The order of the vertex attributes must be the same as specified at construction time viaVertexAttributes
.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
-
updateVertices
void updateVertices(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
-
getBuffer
FloatBuffer getBuffer()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 usesetVertices(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. -
bind
Binds this VertexData for rendering via glDrawArrays or glDrawElements.- Parameters:
locations
- array containing the attribute locations.
-
unbind
Unbinds this VertexData. -
unbind
Unbinds this VertexData.- Parameters:
locations
- array containing the attribute locations.
-
invalidate
void invalidate()Invalidates the VertexData if applicable. Use this in case of a context loss. -
dispose
void dispose()Disposes this VertexData and all its associated OpenGL resources.- Specified by:
dispose
in interfacecom.badlogic.gdx.utils.Disposable
-