Package icyllis.arc3d.opengl
Class GLVertexArray
java.lang.Object
icyllis.arc3d.core.RefCnt
icyllis.arc3d.engine.ManagedResource
icyllis.arc3d.opengl.GLVertexArray
- All Implemented Interfaces:
RefCounted
This class manages the lifetime of the vertex array object and is used to track the state of the
vertex array to avoid redundant GL calls.
The implementation attempts to utilize ARB_vertex_attrib_binding that is available in OpenGL 4.3 and OpenGL ES 3.1. Except for buffer binding, all other states are immutable after creation. See ARB_vertex_attrib_binding
-
Method Summary
Modifier and TypeMethodDescriptionvoid
bindIndexBuffer
(@RawPtr GLBuffer buffer) Set element buffer (index buffer), bind pipeline first.void
bindVertexBuffer
(int binding, @RawPtr GLBuffer buffer, long offset) Set the buffer that stores the attribute data, bind pipeline first.protected void
Override this method to invoke de-allocation of the underlying resource.void
discard()
int
protected GLDevice
int
int
getInputRate
(int binding) int
getStride
(int binding) static @SharedPtr GLVertexArray
make
(GLDevice device, VertexInputLayout inputLayout, String label)
-
Method Details
-
make
@Nullable @SharedPtr public static @SharedPtr GLVertexArray make(@Nonnull GLDevice device, @Nonnull VertexInputLayout inputLayout, String label) -
deallocate
protected void deallocate()Description copied from class:RefCnt
Override this method to invoke de-allocation of the underlying resource.- Specified by:
deallocate
in classRefCnt
-
discard
public void discard() -
getHandle
public int getHandle() -
getBindingCount
public int getBindingCount() -
getStride
public int getStride(int binding) -
getInputRate
public int getInputRate(int binding) -
bindIndexBuffer
Set element buffer (index buffer), bind pipeline first.- Parameters:
buffer
- the element buffer object, raw ptr
-
bindVertexBuffer
Set the buffer that stores the attribute data, bind pipeline first.The stride, the distance to the next vertex data, in bytes, is determined in constructor.
- Parameters:
buffer
- the vertex buffer object, raw ptroffset
- first vertex data to the base of the buffer, in bytes
-
getDevice
- Overrides:
getDevice
in classManagedResource
-