Package org.xjge.graphics
Class Graphics
java.lang.Object
org.xjge.graphics.Graphics
public final class Graphics
extends java.lang.Object
Component object that supplies implementing objects with the following:
- A vertex buffer object - As a default buffer through which the
implementing class may supply its vertex data to the
graphics pipeline
. - A index buffer object - To discourage data redundancy by specifying which vertices to reuse for the objects model mesh.
- A vertex array object - For providing convenient access to the default vertex buffer in addition to any the implementation may define.
Implementing objects should define their vertex data and vertex attribute
layouts in their constructors using LWJGLs memory utilities such as
MemoryUtil
or
MemoryStack
(the later of which only if
the vertex data doesn't exceed the JVMs stack size). LWJGLs
Assimp
binding is also available in
conjunction to the previously mentioned classes to load vertex data in the
form of a 3D model.
- Since:
- 2.0.0
-
Field Summary
-
Constructor Summary
Constructors Constructor Description Graphics()
-
Method Summary
Modifier and Type Method Description void
bindBuffers()
Convenience method provided to bind the default buffers defined by this class.void
freeBuffers()
Convenience method which frees the default buffer objects defined by this class.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Field Details
-
vao
public final int vao -
vbo
public final int vbo -
ibo
public final int ibo -
vertices
public java.nio.FloatBuffer vertices -
indices
public java.nio.IntBuffer indices -
modelMatrix
public org.joml.Matrix4f modelMatrix
-
-
Constructor Details
-
Graphics
public Graphics()
-
-
Method Details
-
bindBuffers
public void bindBuffers()Convenience method provided to bind the default buffers defined by this class. Implementing classes are expected to define vertex attribute layouts following this call in their constructors with methods likeglVertexAttribPointer()
. -
freeBuffers
public void freeBuffers()Convenience method which frees the default buffer objects defined by this class. Additional buffers required by the implementing object will need to be freed individually. This method should be called in conjunction withMemoryUtil.memFree()
if additional data was used during the implementing objects lifetime.
-