Package dev.prozilla.pine.core.rendering
Class VertexBufferObject
java.lang.Object
dev.prozilla.pine.core.rendering.VertexBufferObject
- All Implemented Interfaces:
Lifecycle
Represents a Vertex Buffer Object (VBO).
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
bind
(int target) Binds this VBO with specified target.void
destroy()
Deletes this VBO.int
getId()
Getter for the Vertex Buffer Object ID.void
uploadData
(int target, long size, int usage) Upload null data to this VBO with specified target, size and usage.void
uploadData
(int target, FloatBuffer data, int usage) Upload vertex data to this VBO with specified target, data and usage.void
uploadData
(int target, IntBuffer data, int usage) Upload element data to this EBO with specified target, data and usage.void
uploadSubData
(int target, long offset, FloatBuffer data) Upload sub data to this VBO with specified target, offset and data.
-
Constructor Details
-
VertexBufferObject
public VertexBufferObject()Creates a Vertex Buffer Object (VBO).
-
-
Method Details
-
bind
public void bind(int target) Binds this VBO with specified target. The target in the tutorial should beGL_ARRAY_BUFFER
most of the time.- Parameters:
target
- Target to bind
-
uploadData
Upload vertex data to this VBO with specified target, data and usage. The target in the tutorial should beGL_ARRAY_BUFFER
and usage should beGL_STATIC_DRAW
most of the time.- Parameters:
target
- Target to uploaddata
- Buffer with the data to uploadusage
- Usage of the data
-
uploadData
public void uploadData(int target, long size, int usage) Upload null data to this VBO with specified target, size and usage. The target in the tutorial should beGL_ARRAY_BUFFER
and usage should beGL_STATIC_DRAW
most of the time.- Parameters:
target
- Target to uploadsize
- Size in bytes of the VBO data storeusage
- Usage of the data
-
uploadSubData
Upload sub data to this VBO with specified target, offset and data. The target in the tutorial should beGL_ARRAY_BUFFER
most of the time.- Parameters:
target
- Target to uploadoffset
- Offset where the data should go in bytesdata
- Buffer with the data to upload
-
uploadData
Upload element data to this EBO with specified target, data and usage. The target in the tutorial should beGL_ELEMENT_ARRAY_BUFFER
and usage should beGL_STATIC_DRAW
most of the time.- Parameters:
target
- Target to uploaddata
- Buffer with the data to uploadusage
- Usage of the data
-
destroy
public void destroy()Deletes this VBO. -
getId
public int getId()Getter for the Vertex Buffer Object ID.- Returns:
- Handle of the VBO
-