public class GLArrayDataClient extends GLArrayDataWrapper implements GLArrayDataEditable
DEBUG
Constructor and Description |
---|
GLArrayDataClient(GLArrayDataClient src)
Copy Constructor
|
Modifier and Type | Method and Description |
---|---|
void |
associate(Object obj,
boolean enable)
Implementation and type dependent object association.
|
boolean |
bindBuffer(GL gl,
boolean bind)
if
bind is true and the data uses VBO ,
the latter will be bound and data written to the GPU if required. |
static GLArrayDataClient |
createFixed(int index,
int comps,
int dataType,
boolean normalized,
int initialElementCount)
Create a client side buffer object, using a predefined fixed function array index
and starting with a new created Buffer object with initialElementCount size
On profiles GL2 and ES1 the fixed function pipeline behavior is as expected.
|
static GLArrayDataClient |
createFixed(int index,
int comps,
int dataType,
boolean normalized,
int stride,
Buffer buffer)
Create a client side buffer object, 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 GLArrayDataClient |
createGLSL(String name,
int comps,
int dataType,
boolean normalized,
int initialElementCount)
Create a client side buffer object, using a custom GLSL array attribute name
and starting with a new created Buffer object with initialElementCount size
|
static GLArrayDataClient |
createGLSL(String name,
int comps,
int dataType,
boolean normalized,
int stride,
Buffer buffer)
Create a client side buffer object, using a custom GLSL array attribute name
and starting with a given Buffer object incl it's stride
|
void |
destroy(GL gl) |
void |
enableBuffer(GL gl,
boolean enable)
Enables the buffer if
enable is true ,
and transfers the data if required. |
boolean |
enabled() |
boolean |
isVBOWritten()
Is the buffer written to the VBO ?
|
void |
padding(int doneInByteSize) |
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
disables write operations to the buffer.
|
void |
seal(GL gl,
boolean seal)
Convenience method calling
GLArrayDataEditable.seal(boolean) and GLArrayDataEditable.enableBuffer(GL, boolean) . |
boolean |
sealed() |
void |
setEnableAlways(boolean always)
Affects the behavior of 'enableBuffer'.
|
void |
setVBOWritten(boolean written)
Marks the buffer written to the VBO
|
String |
toString() |
createFixed, createFixed, createGLSL, createGLSL, getBuffer, getBufferClass, getBufferClass, getComponentCount, getComponentSizeInBytes, getComponentType, getElementCount, getIndex, getLocation, getName, getNormalized, getSizeInBytes, getStride, getVBOName, getVBOOffset, getVBOTarget, getVBOUsage, isVBO, isVertexAttribute, setLocation, setLocation, setLocation, setName, setVBOEnabled, setVBOName, setVBOTarget, setVBOUsage, validate
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
getBuffer, getComponentCount, getComponentSizeInBytes, getComponentType, getElementCount, getIndex, getLocation, getName, getNormalized, getSizeInBytes, getStride, getVBOName, getVBOOffset, getVBOTarget, getVBOUsage, isVBO, isVertexAttribute, setLocation, setLocation, setLocation, setName
public GLArrayDataClient(GLArrayDataClient src)
Buffer is sliced
, i.e. sharing content but using own state.
All other values are simply copied.
public static GLArrayDataClient createFixed(int index, int comps, int dataType, boolean normalized, int initialElementCount) throws GLException
GLPointerFuncUtil.getPredefinedArrayIndexName(int)
.index
- The GL array indexcomps
- The array component numberdataType
- The array index GL data typenormalized
- Whether the data shall be normalizedinitialElementCount
- GLException
com.jogamp.opengl.GLContext#getPredefinedArrayIndexName(int)
public static GLArrayDataClient createFixed(int index, int comps, int dataType, boolean normalized, int stride, Buffer buffer) throws GLException
GLPointerFuncUtil.getPredefinedArrayIndexName(int)
.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 dataGLException
com.jogamp.opengl.GLContext#getPredefinedArrayIndexName(int)
public static GLArrayDataClient createGLSL(String name, int comps, int dataType, boolean normalized, int initialElementCount) throws GLException
name
- The custom name for the GL attribute.comps
- The array component numberdataType
- The array index GL data typenormalized
- Whether the data shall be normalizedinitialElementCount
- GLException
public static GLArrayDataClient createGLSL(String name, int comps, int dataType, boolean normalized, int stride, Buffer buffer) throws GLException
name
- The custom name for the GL attribute.comps
- The array component numberdataType
- The array index GL data typenormalized
- Whether the data shall be normalizedstride
- buffer
- the user define dataGLException
public void associate(Object obj, boolean enable)
GLArrayData
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)
.
associate
in interface GLArrayData
associate
in class GLArrayDataWrapper
obj
- implementation and type dependent associationenable
- pass true to enable the association and false to disable it.public final boolean isVBOWritten()
GLArrayDataEditable
isVBOWritten
in interface GLArrayDataEditable
public final boolean sealed()
sealed
in interface GLArrayDataEditable
public final boolean enabled()
enabled
in interface GLArrayDataEditable
public final void setVBOWritten(boolean written)
GLArrayDataEditable
setVBOWritten
in interface GLArrayDataEditable
public void destroy(GL gl)
destroy
in interface GLArrayData
destroy
in interface GLArrayDataEditable
destroy
in class GLArrayDataWrapper
public void reset(GL gl)
reset
in interface GLArrayDataEditable
public void seal(GL gl, boolean seal)
GLArrayDataEditable
GLArrayDataEditable.seal(boolean)
and GLArrayDataEditable.enableBuffer(GL, boolean)
.seal
in interface GLArrayDataEditable
GLArrayDataEditable.seal(boolean)
,
GLArrayDataEditable.enableBuffer(GL, boolean)
public void enableBuffer(GL gl, boolean enable)
GLArrayDataEditable
enable
is true
,
and transfers the data if required.
In case VBO is used
, it is bound accordingly for the data transfer and association,
i.e. it issued GLArrayDataEditable.bindBuffer(GL, boolean)
.
The VBO buffer is unbound when the method returns.
Disables the buffer if enable
is false
.
The action will only be executed, if the internal enable state differs, or 'setEnableAlways' was called with 'true'.
It is up to the user to enable/disable the array properly, ie in case of multiple data sets for the same vertex attribute (VA). Meaning in such case usage of one set while expecting another one to be used for the same VA implies decorating each usage with enable/disable.
enableBuffer
in interface GLArrayDataEditable
GLArrayDataEditable.setEnableAlways(boolean)
public boolean bindBuffer(GL gl, boolean bind)
GLArrayDataEditable
bind
is true and the data uses VBO
,
the latter will be bound and data written to the GPU if required.
If bind
is false and the data uses VBO
,
the latter will be unbound.
This method is exposed to allow data VBO arrays, i.e. GL.GL_ELEMENT_ARRAY_BUFFER
,
to be bounded and written while keeping the VBO bound. The latter is in contrast to GLArrayDataEditable.enableBuffer(GL, boolean)
,
which leaves the VBO unbound, since it's not required for vertex attributes or pointers.
bindBuffer
in interface GLArrayDataEditable
gl
- current GL objectbind
- true if VBO shall be bound and data written,
otherwise clear VBO binding.public void setEnableAlways(boolean always)
GLArrayDataEditable
setEnableAlways
in interface GLArrayDataEditable
GLArrayDataEditable.enableBuffer(GL, boolean)
public void reset()
reset
in interface GLArrayDataEditable
public void seal(boolean seal)
GLArrayDataEditable
If seal is true, it disables 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.
seal
in interface GLArrayDataEditable
GLArrayDataEditable.seal(boolean)
public void rewind()
rewind
in interface GLArrayDataEditable
public void padding(int doneInByteSize)
padding
in interface GLArrayDataEditable
public void put(Buffer v)
put
in interface GLArrayDataEditable
public void putb(byte v)
putb
in interface GLArrayDataEditable
public void puts(short v)
puts
in interface GLArrayDataEditable
public void puti(int v)
puti
in interface GLArrayDataEditable
public void putx(int v)
putx
in interface GLArrayDataEditable
public void putf(float v)
putf
in interface GLArrayDataEditable
public String toString()
toString
in interface GLArrayData
toString
in class GLArrayDataWrapper
Copyright 2010 JogAmp Community.