com.sun.opengl.util
Class GLArrayDataClient

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

public class GLArrayDataClient
extends GLArrayDataWrapper
implements GLArrayDataEditable


Field Summary
protected  boolean bufferEnabled
           
protected  boolean bufferWritten
           
protected  boolean enableBufferAlways
           
protected  GLArrayHandler glArrayHandler
           
static boolean hasVBOBug
          The OpenGL ES emulation on the PC probably has a buggy VBO implementation, where we have to 'refresh' the VertexPointer or VertexAttribArray after each BindBuffer ! This should not be necessary on proper native implementations.
protected  int initialSize
           
protected  boolean sealed
           
protected  boolean sealedGL
           
 
Fields inherited from class com.sun.opengl.util.GLArrayDataWrapper
buffer, bufferOffset, clazz, components, dataType, index, isVertexAttribute, location, name, normalized, stride, strideB, strideL, vboName, vboUsage
 
Constructor Summary
protected GLArrayDataClient()
           
 
Method Summary
protected  void checkSeal(boolean test)
           
static GLArrayDataClient createFixed(GL gl, int index, String name, int comps, int dataType, boolean normalized, int initialSize)
           
static GLArrayDataClient createFixed(GL gl, int index, String name, int comps, int dataType, boolean normalized, int stride, Buffer buffer)
           
static GLArrayDataClient createGLSL(GL gl, String name, int comps, int dataType, boolean normalized, int initialSize)
           
static GLArrayDataClient createGLSL(GL gl, String name, int comps, int dataType, boolean normalized, int stride, Buffer buffer)
           
 void destroy(GL gl)
           
 void enableBuffer(GL gl, boolean enable)
          Enables/disables the buffer, which implies the client state, binding the VBO and transfering the data if not done yet.
 int getBufferUsage()
          The VBO buffer usage, if it's an VBO, otherwise -1
protected  void growBuffer(int additional)
           
protected  boolean growBufferIfNecessary(int spare)
           
protected  void init_vbo(GL gl)
           
protected  void init(String name, int index, int comps, int dataType, boolean normalized, int stride, Buffer data, int initialSize, boolean isVertexAttribute, GLArrayHandler handler, int vboName, long bufferOffset)
           
 boolean isBufferWritten()
          Is the buffer written to the GPU ?
 void padding(int done)
           
 void put(Buffer v)
          Generic buffer relative put method.
 void putb(byte v)
           
 void putf(float v)
           
 void puti(int v)
           
 void puts(short v)
           
 void putx(int v)
           
 void reset()
           
 void reset(GL gl)
           
 void rewind()
           
 void seal(boolean seal)
          If seal is true, it disable write operations to the buffer.
 void seal(GL gl, boolean seal)
          If seal is true, it disable write operations to the buffer.
 boolean sealed()
           
 void setBufferWritten(boolean written)
          Marks the buffer written to the GPU
 void setEnableAlways(boolean always)
          Affects the behavior of 'enableBuffer'.
 String toString()
           
 
Methods inherited from class com.sun.opengl.util.GLArrayDataWrapper
createFixed, createGLSL, getBuffer, getBufferClass, getBufferClass, getComponentNumber, getComponentSize, getComponentType, getElementNumber, getIndex, getLocation, getName, getNormalized, getOffset, getStride, getVBOName, init, isVBO, isVertexAttribute, setLocation, setName, setVBOName, setVBOUsage
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface javax.media.opengl.GLArrayData
getBuffer, getComponentNumber, getComponentSize, getComponentType, getElementNumber, getIndex, getLocation, getName, getNormalized, getOffset, getStride, getVBOName, isVBO, isVertexAttribute, setLocation, setName
 

Field Detail

hasVBOBug

public static final boolean hasVBOBug
The OpenGL ES emulation on the PC probably has a buggy VBO implementation, where we have to 'refresh' the VertexPointer or VertexAttribArray after each BindBuffer ! This should not be necessary on proper native implementations.


sealed

protected boolean sealed

sealedGL

protected boolean sealedGL

bufferEnabled

protected boolean bufferEnabled

bufferWritten

protected boolean bufferWritten

enableBufferAlways

protected boolean enableBufferAlways

initialSize

protected int initialSize

glArrayHandler

protected GLArrayHandler glArrayHandler
Constructor Detail

GLArrayDataClient

protected GLArrayDataClient()
Method Detail

createFixed

public static GLArrayDataClient createFixed(GL gl,
                                            int index,
                                            String name,
                                            int comps,
                                            int dataType,
                                            boolean normalized,
                                            int initialSize)
                                     throws GLException
Parameters:
index - The GL array index
name - The optional custom name for the GL array index, maybe null. If null, the default name mapping will be used, see 'getPredefinedArrayIndexName(int)'. This name might be used as the shader attribute name.
comps - The array component number
dataType - The array index GL data type
normalized - Wheather the data shall be normalized
Throws:
GLException
See Also:
javax.media.opengl.GLContext#getPredefinedArrayIndexName(int)

createFixed

public static GLArrayDataClient createFixed(GL gl,
                                            int index,
                                            String name,
                                            int comps,
                                            int dataType,
                                            boolean normalized,
                                            int stride,
                                            Buffer buffer)
                                     throws GLException
Throws:
GLException

createGLSL

public static GLArrayDataClient createGLSL(GL gl,
                                           String name,
                                           int comps,
                                           int dataType,
                                           boolean normalized,
                                           int initialSize)
                                    throws GLException
Throws:
GLException

createGLSL

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

isBufferWritten

public final boolean isBufferWritten()
Description copied from interface: GLArrayDataEditable
Is the buffer written to the GPU ?

Specified by:
isBufferWritten in interface GLArrayDataEditable

sealed

public final boolean sealed()
Specified by:
sealed in interface GLArrayDataEditable

getBufferUsage

public int getBufferUsage()
Description copied from interface: GLArrayDataEditable
The VBO buffer usage, if it's an VBO, otherwise -1

Specified by:
getBufferUsage in interface GLArrayDataEditable

setBufferWritten

public final void setBufferWritten(boolean written)
Description copied from interface: GLArrayDataEditable
Marks the buffer written to the GPU

Specified by:
setBufferWritten in interface GLArrayDataEditable

destroy

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

reset

public void reset(GL gl)
Specified by:
reset in interface GLArrayDataEditable

seal

public void seal(GL gl,
                 boolean seal)
Description copied from interface: GLArrayDataEditable
If seal is true, it disable write operations to the buffer. Calls flip, ie limit:=position and position:=0. Also enables the buffer for OpenGL, and passes the data. 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. Also disables the buffer for OpenGL.

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

enableBuffer

public void enableBuffer(GL gl,
                         boolean enable)
Description copied from interface: GLArrayDataEditable
Enables/disables the buffer, which implies the client state, binding the VBO and transfering the data if not done yet. The above will only be executed, if the buffer is disabled, or 'setEnableAlways' was called with 'true'.

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

setEnableAlways

public void setEnableAlways(boolean always)
Description copied from interface: GLArrayDataEditable
Affects the behavior of 'enableBuffer'. The default is 'false' This is usefull when you mix up GLArrayData usage with conventional GL array calls.

Specified by:
setEnableAlways in interface GLArrayDataEditable
See Also:
GLArrayDataEditable.enableBuffer(GL, boolean)

reset

public void reset()
Specified by:
reset in interface GLArrayDataEditable

seal

public void seal(boolean seal)
Description copied from interface: GLArrayDataEditable
If seal is true, it disable 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

rewind

public void rewind()
Specified by:
rewind in interface GLArrayDataEditable

padding

public void padding(int done)
Specified by:
padding in interface GLArrayDataEditable

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

putb

public void putb(byte v)
Specified by:
putb in interface GLArrayDataEditable

puts

public void puts(short v)
Specified by:
puts in interface GLArrayDataEditable

puti

public void puti(int v)
Specified by:
puti in interface GLArrayDataEditable

putx

public void putx(int v)
Specified by:
putx in interface GLArrayDataEditable

putf

public void putf(float v)
Specified by:
putf in interface GLArrayDataEditable

toString

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

growBufferIfNecessary

protected final boolean growBufferIfNecessary(int spare)

growBuffer

protected final void growBuffer(int additional)

checkSeal

protected final void checkSeal(boolean test)
                        throws GLException
Throws:
GLException

init

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

init_vbo

protected void init_vbo(GL gl)


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