Class GLArrayDataClient

    • Constructor Detail

      • GLArrayDataClient

        public GLArrayDataClient​(GLArrayDataClient src)
        Copy Constructor

        Buffer is sliced, i.e. sharing content but using own state.

        All other values are simply copied.

    • Method Detail

      • createFixed

        public static GLArrayDataClient createFixed​(int index,
                                                    int comps,
                                                    int dataType,
                                                    boolean normalized,
                                                    int initialElementCount)
                                             throws GLException
        Create a client side buffer object, using a predefined fixed function array index and starting with a new created Buffer object with initialElementCount size On profiles GL2 and ES1 the fixed function pipeline behavior is as expected. On profile ES2 the fixed function emulation will transform these calls to EnableVertexAttribArray and VertexAttribPointer calls, and a predefined vertex attribute variable name will be chosen. The default name mapping will be used, see GLPointerFuncUtil.getPredefinedArrayIndexName(int).
        Parameters:
        index - The GL array index
        comps - The array component number
        dataType - The array index GL data type
        normalized - Whether the data shall be normalized
        initialElementCount -
        Throws:
        GLException
        See Also:
        com.jogamp.opengl.GLContext#getPredefinedArrayIndexName(int)
      • createFixed

        public static GLArrayDataClient createFixed​(int index,
                                                    int comps,
                                                    int dataType,
                                                    boolean normalized,
                                                    int stride,
                                                    Buffer buffer)
                                             throws GLException
        Create a client side buffer object, using a predefined fixed function array index and starting with a given Buffer object incl it's stride On profiles GL2 and ES1 the fixed function pipeline behavior is as expected. On profile ES2 the fixed function emulation will transform these calls to EnableVertexAttribArray and VertexAttribPointer calls, and a predefined vertex attribute variable name will be chosen. The default name mapping will be used, see GLPointerFuncUtil.getPredefinedArrayIndexName(int).
        Parameters:
        index - The GL array index
        comps - The array component number
        dataType - The array index GL data type
        normalized - Whether the data shall be normalized
        stride -
        buffer - the user define data
        Throws:
        GLException
        See Also:
        com.jogamp.opengl.GLContext#getPredefinedArrayIndexName(int)
      • createGLSL

        public static GLArrayDataClient createGLSL​(String name,
                                                   int comps,
                                                   int dataType,
                                                   boolean normalized,
                                                   int initialElementCount)
                                            throws GLException
        Create a client side buffer object, using a custom GLSL array attribute name and starting with a new created Buffer object with initialElementCount size
        Parameters:
        name - The custom name for the GL attribute.
        comps - The array component number
        dataType - The array index GL data type
        normalized - Whether the data shall be normalized
        initialElementCount -
        Throws:
        GLException
      • createGLSL

        public static GLArrayDataClient createGLSL​(String name,
                                                   int comps,
                                                   int dataType,
                                                   boolean normalized,
                                                   int stride,
                                                   Buffer buffer)
                                            throws GLException
        Create a client side buffer object, using a custom GLSL array attribute name and starting with a given Buffer object incl it's stride
        Parameters:
        name - The custom name for the GL attribute.
        comps - The array component number
        dataType - The array index GL data type
        normalized - Whether the data shall be normalized
        stride -
        buffer - the user define data
        Throws:
        GLException
      • associate

        public void associate​(Object obj,
                              boolean enable)
        Description copied from interface: GLArrayData
        Implementation and type dependent object association.

        One currently known use case is to associate a ShaderState to an GLSL aware vertex attribute object, allowing to use the ShaderState to handle it's data persistence, location and state change.
        This is implicitly done via shaderState.ownAttribute(GLArrayData, boolean).

        Specified by:
        associate in interface GLArrayData
        Overrides:
        associate in class GLArrayDataWrapper
        Parameters:
        obj - implementation and type dependent association
        enable - pass true to enable the association and false to disable it.
      • enableBuffer

        public void enableBuffer​(GL gl,
                                 boolean enable)
        Description copied from interface: GLArrayDataEditable
        Enables the buffer if enable is true, and transfers the data if required. In case VBO is used, it is bound accordingly for the data transfer and association, i.e. it issued GLArrayDataEditable.bindBuffer(GL, boolean). The VBO buffer is unbound when the method returns.

        Disables the buffer if enable is false.

        The action will only be executed, if the internal enable state differs, or 'setEnableAlways' was called with 'true'.

        It is up to the user to enable/disable the array properly, ie in case of multiple data sets for the same vertex attribute (VA). Meaning in such case usage of one set while expecting another one to be used for the same VA implies decorating each usage with enable/disable.

        Specified by:
        enableBuffer in interface GLArrayDataEditable
        See Also:
        GLArrayDataEditable.setEnableAlways(boolean)
      • bindBuffer

        public boolean bindBuffer​(GL gl,
                                  boolean bind)
        Description copied from interface: GLArrayDataEditable
        if bind is true and the data uses VBO, the latter will be bound and data written to the GPU if required.

        If bind is false and the data uses VBO, the latter will be unbound.

        This method is exposed to allow data VBO arrays, i.e. GL.GL_ELEMENT_ARRAY_BUFFER, to be bounded and written while keeping the VBO bound. The latter is in contrast to GLArrayDataEditable.enableBuffer(GL, boolean), which leaves the VBO unbound, since it's not required for vertex attributes or pointers.

        Specified by:
        bindBuffer in interface GLArrayDataEditable
        Parameters:
        gl - current GL object
        bind - true if VBO shall be bound and data written, otherwise clear VBO binding.
        Returns:
        true if data uses VBO and action was performed, otherwise false
      • seal

        public void seal​(boolean seal)
        Description copied from interface: GLArrayDataEditable

        If seal is true, it disables write operations to the buffer. Calls flip, ie limit:=position and position:=0.

        If seal is false, it enable write operations continuing at the buffer position, where you left off at seal(true), ie position:=limit and limit:=capacity.

        Specified by:
        seal in interface GLArrayDataEditable
        See Also:
        GLArrayDataEditable.seal(boolean)
      • put

        public void put​(Buffer v)
        Generic buffer relative put method. This class buffer Class must match the arguments buffer class. The arguments remaining elements must be a multiple of this arrays element stride.
        Specified by:
        put in interface GLArrayDataEditable