public class GLArrayDataWrapper extends Object implements GLArrayData
| Modifier and Type | Field and Description |
|---|---|
static boolean |
DEBUG |
| Modifier and Type | Method and Description |
|---|---|
static GLArrayDataWrapper |
createFixed(int index,
int comps,
int dataType,
boolean normalized,
int stride,
Buffer buffer,
int vboName,
long vboOffset,
int vboUsage,
int vboTarget)
Create a VBO, using a predefined fixed function array index, wrapping the given data.
|
static GLArrayDataWrapper |
createGLSL(String name,
int comps,
int dataType,
boolean normalized,
int stride,
Buffer buffer,
int vboName,
long vboOffset,
int vboUsage,
int vboTarget)
Create a VBO, using a custom GLSL array attribute name, wrapping the given data.
|
void |
destroy(GL gl) |
Buffer |
getBuffer()
The Buffer holding the data, may be null if a GPU buffer without client bound data
|
Class |
getBufferClass() |
static Class |
getBufferClass(int dataType) |
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
|
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 |
setVBOEnabled(boolean vboEnabled)
Enable or disable use of VBO.
|
void |
setVBOName(int vboName)
Set the VBO buffer name, if valid (!= 0) enable use of VBO,
otherwise (==0) disable VBO usage.
|
void |
setVBOTarget(int vboTarget) |
void |
setVBOUsage(int vboUsage) |
String |
toString() |
boolean |
validate(GLProfile glp,
boolean throwException)
Validates this instance's parameter.
|
public static GLArrayDataWrapper createFixed(int index, int comps, int dataType, boolean normalized, int stride, Buffer buffer, int vboName, long vboOffset, int vboUsage, int vboTarget) throws GLException
index - The GL array indexcomps - The array component numberdataType - The array index GL data typenormalized - Whether the data shall be normalizedstride - buffer - the user define datavboName - vboOffset - vboUsage - GL2ES2.GL_STREAM_DRAW, GL.GL_STATIC_DRAW or GL.GL_DYNAMIC_DRAWvboTarget - GL.GL_ARRAY_BUFFER or GL.GL_ELEMENT_ARRAY_BUFFERGLExceptionpublic static GLArrayDataWrapper createGLSL(String name, int comps, int dataType, boolean normalized, int stride, Buffer buffer, int vboName, long vboOffset, int vboUsage, int vboTarget) throws GLException
name - The custom name for the GL attribute, maybe null if gpuBufferTarget is GL.GL_ELEMENT_ARRAY_BUFFERcomps - The array component numberdataType - The array index GL data typenormalized - Whether the data shall be normalizedstride - buffer - the user define datavboName - vboOffset - vboUsage - GL2ES2.GL_STREAM_DRAW, GL.GL_STATIC_DRAW or GL.GL_DYNAMIC_DRAWvboTarget - GL.GL_ARRAY_BUFFER or GL.GL_ELEMENT_ARRAY_BUFFERGLExceptionpublic final boolean validate(GLProfile glp, boolean throwException)
GLArrayDataClient and GLArrayDataServer.
GLArrayDataWrapper does not validate it's instance by itself.glp - the GLProfile to usethrowException - whether to throw an exception if this instance has invalid parameter or notpublic final boolean isVertexAttribute()
GLArrayDataisVertexAttribute in interface GLArrayDatapublic final int getIndex()
GLArrayDatagetIndex in interface GLArrayDataGLPointerFunc.GL_VERTEX_ARRAY,
GLPointerFunc.GL_NORMAL_ARRAY,
GLPointerFunc.GL_COLOR_ARRAY,
GLPointerFunc.GL_TEXTURE_COORD_ARRAYpublic final int getLocation()
GLArrayDatagetLocation in interface GLArrayDatapublic final void setLocation(int v)
GLArrayDatasetLocation in interface GLArrayDataShaderState.vertexAttribPointer(GL2ES2, GLArrayData)public final String getName()
GLArrayDatagetName in interface GLArrayDatapublic final long getVBOOffset()
GLArrayDatagetVBOOffset in interface GLArrayDatapublic final int getVBOName()
GLArrayDatagetVBOName in interface GLArrayDatapublic final boolean isVBO()
GLArrayDataisVBO in interface GLArrayDatapublic final int getVBOUsage()
GLArrayDatagetVBOUsage in interface GLArrayDataGL2ES2.GL_STREAM_DRAW, GL.GL_STATIC_DRAW or GL.GL_DYNAMIC_DRAWpublic final int getVBOTarget()
GLArrayDatagetVBOTarget in interface GLArrayDataGL.GL_ARRAY_BUFFER or GL.GL_ELEMENT_ARRAY_BUFFERpublic final Buffer getBuffer()
GLArrayDatagetBuffer in interface GLArrayDatapublic final int getComponentCount()
GLArrayDatagetComponentCount in interface GLArrayDatapublic final int getComponentType()
GLArrayDatagetComponentType in interface GLArrayDatapublic final int getComponentSizeInBytes()
GLArrayDatagetComponentSizeInBytes in interface GLArrayDatapublic final int getElementCount()
GLArrayData
On element consist out of GLArrayData.getComponentCount() components.
getElementCount in interface GLArrayDatapublic final int getSizeInBytes()
GLArrayDatagetSizeInBytes in interface GLArrayDatapublic final boolean getNormalized()
GLArrayData
Default behavior (of the fixed function pipeline) is true
for fixed point data type and false for floating point data types.
getNormalized in interface GLArrayDatapublic final int getStride()
getStride in interface GLArrayDatapublic final Class getBufferClass()
public void destroy(GL gl)
destroy in interface GLArrayDatapublic String toString()
toString in interface GLArrayDatatoString in class Objectpublic static final Class getBufferClass(int dataType)
public void setName(String newName)
GLArrayDatasetName in interface GLArrayDatapublic void setVBOEnabled(boolean vboEnabled)
setVBOName(int)public void setVBOName(int vboName)
setVBOEnabled(boolean)public void setVBOUsage(int vboUsage)
vboUsage - GL2ES2.GL_STREAM_DRAW, GL.GL_STATIC_DRAW or GL.GL_DYNAMIC_DRAWpublic void setVBOTarget(int vboTarget)
vboTarget - either GL.GL_ARRAY_BUFFER or GL.GL_ELEMENT_ARRAY_BUFFERCopyright 2010 JogAmp Community.