Class VertexArrayObject


  • public class VertexArrayObject
    extends Object
    Class that represent an opengl vao
    Author:
    Darius Dinger
    • Constructor Detail

      • VertexArrayObject

        public VertexArrayObject()
        Creates new VertexArrayObject and generate one in opengl
    • Method Detail

      • addVertexBuffer

        public void addVertexBuffer​(float[] values,
                                    int dimension,
                                    int row)
        Adding new VertexBufferObject (VBO) to the VAO
        Parameters:
        values - Values to fill into the buffer
        dimension - Dimension of the values
        row - Row to store the buffer in the vao
      • addVertexBuffer

        public void addVertexBuffer​(int[] values,
                                    int dimension,
                                    int row)
        Adding new VertexBufferObject (VBO) to the VAO
        Parameters:
        values - Values to fill into the buffer
        dimension - Dimension of the values
        row - Row to store the buffer in the vao
      • addIndexBuffer

        public IndexBuffer addIndexBuffer​(int[] indices)
        Creates new IndexBuffer and adding it to the vao
        Parameters:
        indices - Indices for the new index buffer
        Returns:
        IndexBuffer that was created
      • addInstancedVertexBuffer

        public int addInstancedVertexBuffer​(int maxInstances,
                                            int dimension,
                                            int firstRow,
                                            int rowCount)
        Adding a vertex buffer, that change sper instance.
        Parameters:
        maxInstances - Max instances of the vao per render call
        dimension - Dimension of the instanced data
        firstRow - First row of the instanced data
        rowCount - Count of rows of the instanced data
        Returns:
        VBO id of the instanced vertex buffer
      • enableAttributes

        public void enableAttributes()
        Enable all rows of the VAO
      • enableAttribute

        public void enableAttribute​(int row)
        Enable specific row of the VAO
        Parameters:
        row - Row to enable
      • disableAttributes

        public void disableAttributes()
        Disable all rows of the VAO
      • disableAttribute

        public void disableAttribute​(int row)
        Disable specific row of the VAO
        Parameters:
        row - Row to disable
      • bind

        public void bind()
        Bind VAO to opengl
      • unbind

        public final void unbind()
        Unbind VAO from opengl (bind 0)