com.jogamp.opengl.util
Class GLArrayDataServer

java.lang.Object
  extended by com.jogamp.opengl.util.GLArrayDataWrapper
      extended by com.jogamp.opengl.util.GLArrayDataClient
          extended by com.jogamp.opengl.util.GLArrayDataServer
All Implemented Interfaces:
GLArrayDataEditable, GLArrayData

public class GLArrayDataServer
extends GLArrayDataClient
implements GLArrayDataEditable


Constructor Summary
GLArrayDataServer()
           
 
Method Summary
 GLArrayData addFixedSubArray(int index, int comps, int vboTarget)
          Configure a segment of this fixed function interleaved array (see createFixedInterleaved(int, int, boolean, int, int)).
 GLArrayData addGLSLSubArray(String name, int comps, int vboTarget)
          Configure a segment of this GLSL interleaved array (see createGLSLInterleaved(int, int, boolean, int, int)).
static GLArrayDataServer createData(int comps, int dataType, int stride, Buffer buffer, int vboUsage, int vboTarget)
          Create a VBO data object for any target w/o render pipeline association, ie GL.GL_ELEMENT_ARRAY_BUFFER.
static GLArrayDataServer createData(int comps, int dataType, int initialSize, int vboUsage, int vboTarget)
          Create a VBO data object for any target w/o render pipeline association, ie GL.GL_ELEMENT_ARRAY_BUFFER.
static GLArrayDataServer createFixed(int index, int comps, int dataType, boolean normalized, int stride, Buffer buffer, int vboUsage)
          Create a VBO, 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.
static GLArrayDataServer createFixed(int index, int comps, int dataType, boolean normalized, int initialSize, int vboUsage)
          Create a VBO, using a predefined fixed function array index and starting with a new created Buffer object with initialSize size On profiles GL2 and ES1 the fixed function pipeline behavior is as expected.
static GLArrayDataServer createFixedInterleaved(int comps, int dataType, boolean normalized, int initialSize, int vboUsage)
          Create a VBO for fixed function interleaved array data starting with a new created Buffer object with initialSize size.
static GLArrayDataServer createGLSL(String name, int comps, int dataType, boolean normalized, int stride, Buffer buffer, int vboUsage)
          Create a VBO, using a custom GLSL array attribute name and starting with a given Buffer object incl it's stride
static GLArrayDataServer createGLSL(String name, int comps, int dataType, boolean normalized, int initialSize, int vboUsage)
          Create a VBO, using a custom GLSL array attribute name and starting with a new created Buffer object with initialSize size
static GLArrayDataServer createGLSLInterleaved(int comps, int dataType, boolean normalized, int initialSize, int vboUsage)
          Create a VBO for GLSL interleaved array data starting with a new created Buffer object with initialSize size.
 void destroy(GL gl)
           
 void setVBOEnabled(boolean vboUsage)
          Convenient way do disable the VBO behavior and switch to client side data one Only possible if buffer is defined.
 String toString()
           
 
Methods inherited from class com.jogamp.opengl.util.GLArrayDataClient
createFixed, createFixed, createGLSL, createGLSL, enableBuffer, enabled, isVBOWritten, padding, put, putb, putf, puti, puts, putx, reset, reset, rewind, seal, seal, sealed, setEnableAlways, setVBOWritten
 
Methods inherited from class com.jogamp.opengl.util.GLArrayDataWrapper
createFixed, createGLSL, getBuffer, getBufferClass, getBufferClass, getComponentCount, getComponentSizeInBytes, getComponentType, getElementCount, getIndex, getLocation, getName, getNormalized, getSizeInBytes, getStride, getVBOName, getVBOOffset, getVBOTarget, getVBOUsage, isVBO, isVertexAttribute, setLocation, setName, setVBOName, setVBOTarget, setVBOUsage, validate
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.jogamp.opengl.util.GLArrayDataEditable
enableBuffer, enabled, isVBOWritten, padding, put, putb, putf, puti, puts, putx, reset, reset, rewind, seal, seal, sealed, setEnableAlways, setVBOWritten
 
Methods inherited from interface javax.media.opengl.GLArrayData
getBuffer, getComponentCount, getComponentSizeInBytes, getComponentType, getElementCount, getIndex, getLocation, getName, getNormalized, getSizeInBytes, getStride, getVBOName, getVBOOffset, getVBOTarget, getVBOUsage, isVBO, isVertexAttribute, setLocation, setName
 

Constructor Detail

GLArrayDataServer

public GLArrayDataServer()
Method Detail

createFixed

public static GLArrayDataServer createFixed(int index,
                                            int comps,
                                            int dataType,
                                            boolean normalized,
                                            int stride,
                                            Buffer buffer,
                                            int vboUsage)
                                     throws GLException
Create a VBO, 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
vboUsage - GL2ES2.GL_STREAM_DRAW, GL.GL_STATIC_DRAW or GL.GL_DYNAMIC_DRAW
Throws:
GLException
See Also:
javax.media.opengl.GLContext#getPredefinedArrayIndexName(int)

createFixed

public static GLArrayDataServer createFixed(int index,
                                            int comps,
                                            int dataType,
                                            boolean normalized,
                                            int initialSize,
                                            int vboUsage)
                                     throws GLException
Create a VBO, using a predefined fixed function array index and starting with a new created Buffer object with initialSize 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
initialSize -
vboUsage - GL2ES2.GL_STREAM_DRAW, GL.GL_STATIC_DRAW or GL.GL_DYNAMIC_DRAW
Throws:
GLException
See Also:
javax.media.opengl.GLContext#getPredefinedArrayIndexName(int)

createGLSL

public static GLArrayDataServer createGLSL(String name,
                                           int comps,
                                           int dataType,
                                           boolean normalized,
                                           int initialSize,
                                           int vboUsage)
                                    throws GLException
Create a VBO, using a custom GLSL array attribute name and starting with a new created Buffer object with initialSize 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
initialSize -
vboUsage - GL2ES2.GL_STREAM_DRAW, GL.GL_STATIC_DRAW or GL.GL_DYNAMIC_DRAW
Throws:
GLException

createGLSL

public static GLArrayDataServer createGLSL(String name,
                                           int comps,
                                           int dataType,
                                           boolean normalized,
                                           int stride,
                                           Buffer buffer,
                                           int vboUsage)
                                    throws GLException
Create a VBO, 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
vboUsage - GL2ES2.GL_STREAM_DRAW, GL.GL_STATIC_DRAW or GL.GL_DYNAMIC_DRAW
Throws:
GLException

createData

public static GLArrayDataServer createData(int comps,
                                           int dataType,
                                           int stride,
                                           Buffer buffer,
                                           int vboUsage,
                                           int vboTarget)
                                    throws GLException
Create a VBO data object for any target w/o render pipeline association, ie GL.GL_ELEMENT_ARRAY_BUFFER. Hence no index, name for a fixed function pipeline nor vertex attribute is given.

Parameters:
comps - The array component number
dataType - The array index GL data type
stride -
buffer - the user define data
vboUsage - GL2ES2.GL_STREAM_DRAW, GL.GL_STATIC_DRAW or GL.GL_DYNAMIC_DRAW
vboTarget - GL.GL_ELEMENT_ARRAY_BUFFER, .. {@link GL#glGenBuffers(int, int[], int)
Throws:
GLException

createData

public static GLArrayDataServer createData(int comps,
                                           int dataType,
                                           int initialSize,
                                           int vboUsage,
                                           int vboTarget)
                                    throws GLException
Create a VBO data object for any target w/o render pipeline association, ie GL.GL_ELEMENT_ARRAY_BUFFER. Hence no index, name for a fixed function pipeline nor vertex attribute is given.

Parameters:
comps - The array component number
dataType - The array index GL data type
initialSize -
vboUsage - GL2ES2.GL_STREAM_DRAW, GL.GL_STATIC_DRAW or GL.GL_DYNAMIC_DRAW
vboTarget - GL.GL_ELEMENT_ARRAY_BUFFER, ..
Throws:
GLException

createFixedInterleaved

public static GLArrayDataServer createFixedInterleaved(int comps,
                                                       int dataType,
                                                       boolean normalized,
                                                       int initialSize,
                                                       int vboUsage)
                                                throws GLException
Create a VBO for fixed function interleaved array data starting with a new created Buffer object with initialSize size.

User needs to configure the interleaved segments via addFixedSubArray(int, int, int).

Parameters:
comps - The total number of all interleaved components.
dataType - The array index GL data type
normalized - Whether the data shall be normalized
initialSize -
vboUsage - GL2ES2.GL_STREAM_DRAW, GL.GL_STATIC_DRAW or GL.GL_DYNAMIC_DRAW
Throws:
GLException

addFixedSubArray

public GLArrayData addFixedSubArray(int index,
                                    int comps,
                                    int vboTarget)
Configure a segment of this fixed function interleaved array (see createFixedInterleaved(int, int, boolean, int, int)).

This method may be called several times as long the sum of interleaved components does not exceed the total number of components of the created interleaved array.

The memory of the the interleaved array is being used.

Must be called before using the array, eg: GLArrayDataClient.seal(boolean), GLArrayDataClient.putf(float), ..

Parameters:
index - The GL array index, maybe -1 if vboTarget is GL.GL_ELEMENT_ARRAY_BUFFER
comps - This interleaved array segment's component number
vboTarget - GL.GL_ARRAY_BUFFER or GL.GL_ELEMENT_ARRAY_BUFFER

createGLSLInterleaved

public static GLArrayDataServer createGLSLInterleaved(int comps,
                                                      int dataType,
                                                      boolean normalized,
                                                      int initialSize,
                                                      int vboUsage)
                                               throws GLException
Create a VBO for GLSL interleaved array data starting with a new created Buffer object with initialSize size.

User needs to configure the interleaved segments via #addGLSLSubArray(int, int, int).

Parameters:
comps - The total number of all interleaved components.
dataType - The array index GL data type
normalized - Whether the data shall be normalized
initialSize -
vboUsage - GL2ES2.GL_STREAM_DRAW, GL.GL_STATIC_DRAW or GL.GL_DYNAMIC_DRAW
Throws:
GLException

addGLSLSubArray

public GLArrayData addGLSLSubArray(String name,
                                   int comps,
                                   int vboTarget)
Configure a segment of this GLSL interleaved array (see createGLSLInterleaved(int, int, boolean, int, int)).

This method may be called several times as long the sum of interleaved components does not exceed the total number of components of the created interleaved array.

The memory of the the interleaved array is being used.

Must be called before using the array, eg: GLArrayDataClient.seal(boolean), GLArrayDataClient.putf(float), ..

Parameters:
name - The custom name for the GL attribute, maybe null if vboTarget is GL.GL_ELEMENT_ARRAY_BUFFER
comps - This interleaved array segment's component number
vboTarget - GL.GL_ARRAY_BUFFER or GL.GL_ELEMENT_ARRAY_BUFFER

destroy

public void destroy(GL gl)
Specified by:
destroy in interface GLArrayDataEditable
Specified by:
destroy in interface GLArrayData
Overrides:
destroy in class GLArrayDataClient

setVBOEnabled

public void setVBOEnabled(boolean vboUsage)
Convenient way do disable the VBO behavior and switch to client side data one Only possible if buffer is defined.

Overrides:
setVBOEnabled in class GLArrayDataWrapper
See Also:
GLArrayDataWrapper.setVBOName(int)

toString

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


Copyright 2010 JogAmp Community.