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 TypeMethodDescriptionvoidbindIndexBuffer(@NonNull @RawPtr GLBuffer buffer) Set element buffer (index buffer), bind pipeline first.voidbindVertexBuffer(int binding, @NonNull @RawPtr GLBuffer buffer, long offset) Set the buffer that stores the attribute data, bind pipeline first.protected voidOverride this method to invoke de-allocation of the underlying resource.voiddiscard()intprotected GLDeviceintintgetInputRate(int binding) intgetStride(int binding) static @Nullable @SharedPtr GLVertexArraymake(@NonNull GLDevice device, @NonNull VertexInputLayout inputLayout, String label)
-
Method Details
-
make
@SharedPtr public static @Nullable @SharedPtr GLVertexArray make(@NonNull GLDevice device, @NonNull VertexInputLayout inputLayout, String label) -
deallocate
protected void deallocate()Description copied from class:RefCntOverride this method to invoke de-allocation of the underlying resource.- Specified by:
deallocatein 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:
getDevicein classManagedResource
-