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