com.sun.opengl.util
Class GLArrayDataWrapper

java.lang.Object
  extended by com.sun.opengl.util.GLArrayDataWrapper
All Implemented Interfaces:
GLArrayData
Direct Known Subclasses:
GLArrayDataClient

public class GLArrayDataWrapper
extends Object
implements GLArrayData


Field Summary
protected  Buffer buffer
           
protected  long bufferOffset
           
protected  Class clazz
           
protected  int components
           
protected  int dataType
           
protected  int index
           
protected  boolean isVertexAttribute
           
protected  int location
           
protected  String name
           
protected  boolean normalized
           
protected  int stride
           
protected  int strideB
           
protected  int strideL
           
protected  int vboName
           
protected  boolean vboUsage
           
 
Constructor Summary
protected GLArrayDataWrapper()
           
 
Method Summary
static GLArrayDataWrapper createFixed(GL gl, int index, int comps, int dataType, boolean normalized, int stride, Buffer buffer, int vboName, long bufferOffset)
           
static GLArrayDataWrapper createGLSL(GL gl, String name, int comps, int dataType, boolean normalized, int stride, Buffer buffer, int vboName, long bufferOffset)
           
 void destroy(GL gl)
           
 Buffer getBuffer()
          The Buffer holding the data, may be null in case of VBO
 Class getBufferClass()
           
static Class getBufferClass(int dataType)
           
 int getComponentNumber()
          The number of components per element
 int getComponentSize()
          The components size in bytes
 int getComponentType()
          The component's GL data type, ie.
 int getElementNumber()
          Return the number of 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
 long getOffset()
          The offset, if it's an VBO, otherwise -1
 int getStride()
          The distance to the next payload, allowing interleaved arrays.
 int getVBOName()
          The VBO name, if it's an VBO, otherwise -1
protected  void init(String name, int index, int comps, int dataType, boolean normalized, int stride, Buffer data, boolean isVertexAttribute, int vboName, long bufferOffset)
           
 boolean isVBO()
          Determines wheather the data is server side (VBO), 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
 void setLocation(int v)
          Sets the determined location of the shader attribute This is usually done within ShaderState.
 void setName(String newName)
          Set a new name for this array.
 void setVBOName(int vboName)
           
 void setVBOUsage(boolean vboUsage)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

index

protected int index

location

protected int location

name

protected String name

components

protected int components

dataType

protected int dataType

normalized

protected boolean normalized

stride

protected int stride

strideB

protected int strideB

strideL

protected int strideL

clazz

protected Class clazz

buffer

protected Buffer buffer

isVertexAttribute

protected boolean isVertexAttribute

bufferOffset

protected long bufferOffset

vboName

protected int vboName

vboUsage

protected boolean vboUsage
Constructor Detail

GLArrayDataWrapper

protected GLArrayDataWrapper()
Method Detail

createFixed

public static GLArrayDataWrapper createFixed(GL gl,
                                             int index,
                                             int comps,
                                             int dataType,
                                             boolean normalized,
                                             int stride,
                                             Buffer buffer,
                                             int vboName,
                                             long bufferOffset)
                                      throws GLException
Throws:
GLException

createGLSL

public static GLArrayDataWrapper createGLSL(GL gl,
                                            String name,
                                            int comps,
                                            int dataType,
                                            boolean normalized,
                                            int stride,
                                            Buffer buffer,
                                            int vboName,
                                            long bufferOffset)
                                     throws GLException
Throws:
GLException

isVertexAttribute

public final boolean isVertexAttribute()
Description copied from interface: GLArrayData
Returns true if this data set is intended for a GLSL vertex shader attribute, otherwise false, ie intended for fixed function vertex pointer

Specified by:
isVertexAttribute in interface GLArrayData

getIndex

public final int getIndex()
Description copied from interface: GLArrayData
The index of the predefined array index, see list below, or -1 in case of a shader attribute array.

Specified by:
getIndex in interface GLArrayData
See Also:
javax.media.opengl.GL#GL_VERTEX_ARRAY, javax.media.opengl.GL#GL_NORMAL_ARRAY, javax.media.opengl.GL#GL_COLOR_ARRAY, javax.media.opengl.GL#GL_TEXTURE_COORD_ARRAY

getLocation

public final int getLocation()
Description copied from interface: GLArrayData
Returns the shader attribute location for this name, -1 if not yet determined

Specified by:
getLocation in interface GLArrayData

setLocation

public final void setLocation(int v)
Description copied from interface: GLArrayData
Sets the determined location of the shader attribute This is usually done within ShaderState.

Specified by:
setLocation in interface GLArrayData
See Also:
javax.media.opengl.glsl.ShaderState#glVertexAttribPointer(GL2ES2, GLArrayData)

getName

public final String getName()
Description copied from interface: GLArrayData
The name of the reflecting shader array attribute.

Specified by:
getName in interface GLArrayData

getOffset

public final long getOffset()
Description copied from interface: GLArrayData
The offset, if it's an VBO, otherwise -1

Specified by:
getOffset in interface GLArrayData

getVBOName

public final int getVBOName()
Description copied from interface: GLArrayData
The VBO name, if it's an VBO, otherwise -1

Specified by:
getVBOName in interface GLArrayData

isVBO

public final boolean isVBO()
Description copied from interface: GLArrayData
Determines wheather the data is server side (VBO), or a client side array (false).

Specified by:
isVBO in interface GLArrayData

getBuffer

public final Buffer getBuffer()
Description copied from interface: GLArrayData
The Buffer holding the data, may be null in case of VBO

Specified by:
getBuffer in interface GLArrayData

getComponentNumber

public final int getComponentNumber()
Description copied from interface: GLArrayData
The number of components per element

Specified by:
getComponentNumber in interface GLArrayData

getComponentType

public final int getComponentType()
Description copied from interface: GLArrayData
The component's GL data type, ie. GL_FLOAT

Specified by:
getComponentType in interface GLArrayData

getComponentSize

public final int getComponentSize()
Description copied from interface: GLArrayData
The components size in bytes

Specified by:
getComponentSize in interface GLArrayData

getElementNumber

public final int getElementNumber()
Description copied from interface: GLArrayData
Return the number of elements.

Specified by:
getElementNumber in interface GLArrayData

getNormalized

public final boolean getNormalized()
Description copied from interface: GLArrayData
True, if GL shall normalize fixed point data while converting them into float

Specified by:
getNormalized in interface GLArrayData

getStride

public final int getStride()
Description copied from interface: GLArrayData
The distance to the next payload, allowing interleaved arrays.

Specified by:
getStride in interface GLArrayData

getBufferClass

public final Class getBufferClass()

destroy

public void destroy(GL gl)
Specified by:
destroy in interface GLArrayData

toString

public String toString()
Specified by:
toString in interface GLArrayData
Overrides:
toString in class Object

getBufferClass

public static final Class getBufferClass(int dataType)

setName

public void setName(String newName)
Description copied from interface: GLArrayData
Set a new name for this array.

Specified by:
setName in interface GLArrayData

setVBOUsage

public void setVBOUsage(boolean vboUsage)

setVBOName

public void setVBOName(int vboName)

init

protected void init(String name,
                    int index,
                    int comps,
                    int dataType,
                    boolean normalized,
                    int stride,
                    Buffer data,
                    boolean isVertexAttribute,
                    int vboName,
                    long bufferOffset)
             throws GLException
Throws:
GLException


Copyright 2005 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms.