javax.media.opengl

## Interface GLArrayData

- All Known Subinterfaces:
    GLArrayDataEditable
  All Known Implementing Classes:
    GLArrayDataClient, GLArrayDataServer, GLArrayDataWrapper

      public interface GLArrayData

  The total number of bytes hold by the referenced buffer is: getComponentSize()* getComponentNumber() * getElementNumber()

- - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `associate(Object obj, boolean enable)` Implementation and type dependent object association.
    `void` | `destroy(GL gl)`
    `Buffer` | `getBuffer()` The Buffer holding the data, may be null if a GPU buffer without client bound data
    `int` | `getComponentCount()` The number of components per element
    `int` | `getComponentSizeInBytes()` The component's size in bytes
    `int` | `getComponentType()` The component's GL data type, ie.
    `int` | `getElementCount()` The current number of used elements.
    `int` | `getIndex()` The index of the predefined array index, see list below, or -1 in case of a shader attribute array.
    `int` | `getLocation()` Returns the shader attribute location for this name, -1 if not yet determined
    `String` | `getName()` The name of the reflecting shader array attribute.
    `boolean` | `getNormalized()` True, if GL shall normalize fixed point data while converting them into float.
    `int` | `getSizeInBytes()` The currently used size in bytes. In case the buffer's position is 0 (sealed, flipped), it's based on it's limit instead of it's position.
    `int` | `getStride()`
    `int` | `getVBOName()` The VBO name or 0 if not a VBO
    `long` | `getVBOOffset()` The VBO buffer offset or 0 if not a VBO
    `int` | `getVBOTarget()` The VBO target or 0 if not a VBO
    `int` | `getVBOUsage()` The VBO usage or 0 if not a VBO
    `boolean` | `isVBO()` Determines whether the data is server side (VBO) and enabled, or a client side array (false).
    `boolean` | `isVertexAttribute()` Returns true if this data set is intended for a GLSL vertex shader attribute, otherwise false, ie intended for fixed function vertex pointer
    `int` | `setLocation(GL2ES2 gl, int program)` Retrieves the location of the shader attribute from the linked shader program.
    `int` | `setLocation(GL2ES2 gl, int program, int location)` Binds the location of the shader attribute to the given location for the unlinked shader program.
    `int` | `setLocation(int v)` Sets the given location of the shader attribute
    `void` | `setName(String newName)` Set a new name for this array.
    `String` | `toString()`

- - ### Method Detail

    - #### associate

          void associate(Object obj,
                       boolean enable)

      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)`.

      Parameters:
        `obj` - implementation and type dependent association
        `enable` - pass true to enable the association and false to disable it.

    - #### isVertexAttribute

          boolean isVertexAttribute()

      Returns true if this data set is intended for a GLSL vertex shader attribute, otherwise false, ie intended for fixed function vertex pointer

    - #### getIndex

          int getIndex()

      The index of the predefined array index, see list below, or -1 in case of a shader attribute array.
      See Also:
        `GLPointerFunc.GL_VERTEX_ARRAY`, `GLPointerFunc.GL_NORMAL_ARRAY`, `GLPointerFunc.GL_COLOR_ARRAY`, `GLPointerFunc.GL_TEXTURE_COORD_ARRAY`

    - #### getName

          String getName()

      The name of the reflecting shader array attribute.

    - #### setName

          void setName(String newName)

      Set a new name for this array.

      This clears the location, i.e. sets it to -1.

      See Also:
        `setLocation(int)`, `setLocation(GL2ES2, int)`

    - #### getLocation

          int getLocation()

      Returns the shader attribute location for this name, -1 if not yet determined

    - #### setLocation

          int setLocation(int v)

      Sets the given location of the shader attribute
      Returns:
        the given location
      See Also:
        `ShaderState.vertexAttribPointer(GL2ES2, GLArrayData)`

    - #### setLocation

          int setLocation(GL2ES2 gl,
                        int program)

      Retrieves the location of the shader attribute from the linked shader program.

      No validation is performed within the implementation.

      Parameters:
        `gl` -
        `program` -
      Returns:
        ≥0 denotes a valid attribute location as found and used in the given shader program. <0 denotes an invalid location, i.e. not found or used in the given shader program.

    - #### setLocation

          int setLocation(GL2ES2 gl,
                        int program,
                        int location)

      Binds the location of the shader attribute to the given location for the unlinked shader program.

      No validation is performed within the implementation.

      Parameters:
        `gl` -
        `program` -
      Returns:
        the given location

    - #### isVBO

          boolean isVBO()

      Determines whether the data is server side (VBO) and enabled, or a client side array (false).

    - #### getVBOOffset

          long getVBOOffset()

      The VBO buffer offset or 0 if not a VBO

    - #### getVBOName

          int getVBOName()

      The VBO name or 0 if not a VBO

    - #### getVBOUsage

          int getVBOUsage()

      The VBO usage or 0 if not a VBO
      Returns:
        0 if not a GPU buffer, otherwise `GL2ES2.GL_STREAM_DRAW`, `GL.GL_STATIC_DRAW` or `GL.GL_DYNAMIC_DRAW`

    - #### getVBOTarget

          int getVBOTarget()

      The VBO target or 0 if not a VBO
      Returns:
        0 if not a GPU buffer, otherwise `GL.GL_ARRAY_BUFFER` or `GL.GL_ELEMENT_ARRAY_BUFFER`

    - #### getBuffer

          Buffer getBuffer()

      The Buffer holding the data, may be null if a GPU buffer without client bound data

    - #### getComponentCount

          int getComponentCount()

      The number of components per element

    - #### getComponentType

          int getComponentType()

      The component's GL data type, ie. GL_FLOAT

    - #### getComponentSizeInBytes

          int getComponentSizeInBytes()

      The component's size in bytes

    - #### getElementCount

          int getElementCount()

      The current number of used elements.

      On element consist out of `getComponentCount()` components.

      In case the buffer's position is 0 (sealed, flipped), it's based on it's limit instead of it's position.

    - #### getSizeInBytes

          int getSizeInBytes()

      The currently used size in bytes.
      In case the buffer's position is 0 (sealed, flipped), it's based on it's limit instead of it's position.

    - #### getNormalized

          boolean getNormalized()

      True, if GL shall normalize fixed point data while converting them into float.

      Default behavior (of the fixed function pipeline) is `true` for fixed point data type and `false` for floating point data types.

    - #### getStride

          int getStride()

      Returns:
        the byte offset between consecutive components

    - #### toString

          String toString()

      Overrides:
        `toString` in class `Object`

    - #### destroy

          void destroy(GL gl)

Copyright 2010 JogAmp Community.