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`

public final class GLVertexArray extends ManagedResource
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 Type
  Method
  Description
  `void`
  `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`
  `deallocate()`
  Override this method to invoke de-allocation of the underlying resource.
  `void`
  `discard()`
  `int`
  `getBindingCount()`
  `protected GLDevice`
  `getDevice()`
  `int`
  `getHandle()`
  `int`
  `getInputRate(int binding)`
  `int`
  `getStride(int binding)`
  `static @SharedPtr GLVertexArray`
  `make(GLDevice device, VertexInputLayout inputLayout, String label)`

  ### Methods inherited from class icyllis.arc3d.core.RefCnt

  `create, create, getRefCnt, getRefCntAcquire, getRefCntVolatile, move, move, ref, unique, unref`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## 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 class `RefCnt`

  - ### 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

    public void bindIndexBuffer(@Nonnull @RawPtr @RawPtr GLBuffer buffer)
    Set element buffer (index buffer), bind pipeline first.
    Parameters:
      `buffer` - the element buffer object, raw ptr

  - ### bindVertexBuffer

    public void bindVertexBuffer(int binding, @Nonnull @RawPtr @RawPtr GLBuffer buffer, long offset)
    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 ptr
      `offset` - first vertex data to the base of the buffer, in bytes

  - ### getDevice

    protected GLDevice getDevice()
    Overrides:
      `getDevice` in class `ManagedResource`