Class GLArrayDataClient
- All Implemented Interfaces:
GLArrayData
,GLArrayDataEditable
- Direct Known Subclasses:
GLArrayDataServer
-
Field Summary
Fields inherited from class com.jogamp.opengl.util.GLArrayDataWrapper
DEBUG
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Implementation and type dependent object association.boolean
bindBuffer
(GL gl, boolean bind) ifbind
is true and the data usesVBO
, 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 sizestatic 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 stridevoid
void
enableBuffer
(GL gl, boolean enable) Enables the buffer ifenable
istrue
, and transfers the data if required.final boolean
enabled()
final boolean
Is the buffer written to the VBO ?void
padding
(int doneInByteSize) void
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
void
rewind()
void
seal
(boolean seal) If seal is true, it disables write operations to the buffer.void
Convenience method callingGLArrayDataEditable.seal(boolean)
andGLArrayDataEditable.enableBuffer(GL, boolean)
.final boolean
sealed()
void
setEnableAlways
(boolean always) Affects the behavior of 'enableBuffer'.final void
setVBOWritten
(boolean written) Marks the buffer written to the VBOtoString()
Methods inherited from class com.jogamp.opengl.util.GLArrayDataWrapper
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
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface com.jogamp.opengl.GLArrayData
getBuffer, getComponentCount, getComponentSizeInBytes, getComponentType, getElementCount, getIndex, getLocation, getName, getNormalized, getSizeInBytes, getStride, getVBOName, getVBOOffset, getVBOTarget, getVBOUsage, isVBO, isVertexAttribute, setLocation, setLocation, setLocation, setName
-
Constructor Details
-
GLArrayDataClient
Copy ConstructorBuffer is
sliced
, i.e. sharing content but using own state.All other values are simply copied.
-
-
Method Details
-
createFixed
public static GLArrayDataClient createFixed(int index, int comps, int dataType, boolean normalized, int initialElementCount) throws GLException 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. 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, seeGLPointerFuncUtil.getPredefinedArrayIndexName(int)
.- Parameters:
index
- The GL array indexcomps
- The array component numberdataType
- The array index GL data typenormalized
- Whether the data shall be normalizedinitialElementCount
-- Throws:
GLException
- See Also:
-
com.jogamp.opengl.GLContext#getPredefinedArrayIndexName(int)
-
createFixed
public static GLArrayDataClient createFixed(int index, int comps, int dataType, boolean normalized, int stride, Buffer buffer) throws GLException 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. 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, seeGLPointerFuncUtil.getPredefinedArrayIndexName(int)
.- Parameters:
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 data- Throws:
GLException
- See Also:
-
com.jogamp.opengl.GLContext#getPredefinedArrayIndexName(int)
-
createGLSL
public static GLArrayDataClient createGLSL(String name, int comps, int dataType, boolean normalized, int initialElementCount) throws GLException Create a client side buffer object, using a custom GLSL array attribute name and starting with a new created Buffer object with initialElementCount size- Parameters:
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
-- Throws:
GLException
-
createGLSL
public static GLArrayDataClient createGLSL(String name, int comps, int dataType, boolean normalized, int stride, Buffer buffer) throws GLException Create a client side buffer object, 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 numberdataType
- The array index GL data typenormalized
- Whether the data shall be normalizedstride
-buffer
- the user define data- Throws:
GLException
-
associate
Description copied from interface:GLArrayData
Implementation and type dependent object association.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 viashaderState.ownAttribute(GLArrayData, boolean)
.- Specified by:
associate
in interfaceGLArrayData
- Overrides:
associate
in classGLArrayDataWrapper
- Parameters:
obj
- implementation and type dependent associationenable
- pass true to enable the association and false to disable it.
-
isVBOWritten
public final boolean isVBOWritten()Description copied from interface:GLArrayDataEditable
Is the buffer written to the VBO ?- Specified by:
isVBOWritten
in interfaceGLArrayDataEditable
-
sealed
public final boolean sealed()- Specified by:
sealed
in interfaceGLArrayDataEditable
-
enabled
public final boolean enabled()- Specified by:
enabled
in interfaceGLArrayDataEditable
-
setVBOWritten
public final void setVBOWritten(boolean written) Description copied from interface:GLArrayDataEditable
Marks the buffer written to the VBO- Specified by:
setVBOWritten
in interfaceGLArrayDataEditable
-
destroy
- Specified by:
destroy
in interfaceGLArrayData
- Specified by:
destroy
in interfaceGLArrayDataEditable
- Overrides:
destroy
in classGLArrayDataWrapper
-
reset
- Specified by:
reset
in interfaceGLArrayDataEditable
-
seal
Description copied from interface:GLArrayDataEditable
Convenience method callingGLArrayDataEditable.seal(boolean)
andGLArrayDataEditable.enableBuffer(GL, boolean)
.- Specified by:
seal
in interfaceGLArrayDataEditable
- See Also:
-
enableBuffer
Description copied from interface:GLArrayDataEditable
Enables the buffer ifenable
istrue
, and transfers the data if required. In caseVBO is used
, it is bound accordingly for the data transfer and association, i.e. it issuedGLArrayDataEditable.bindBuffer(GL, boolean)
. The VBO buffer is unbound when the method returns.Disables the buffer if
enable
isfalse
.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.
- Specified by:
enableBuffer
in interfaceGLArrayDataEditable
- See Also:
-
bindBuffer
Description copied from interface:GLArrayDataEditable
ifbind
is true and the data usesVBO
, the latter will be bound and data written to the GPU if required.If
bind
is false and the data usesVBO
, 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 toGLArrayDataEditable.enableBuffer(GL, boolean)
, which leaves the VBO unbound, since it's not required for vertex attributes or pointers.- Specified by:
bindBuffer
in interfaceGLArrayDataEditable
- Parameters:
gl
- current GL objectbind
- true if VBO shall be bound and data written, otherwise clear VBO binding.- Returns:
- true if data uses VBO and action was performed, otherwise false
-
setEnableAlways
public void setEnableAlways(boolean always) Description copied from interface:GLArrayDataEditable
Affects the behavior of 'enableBuffer'. The default is 'false' This is useful when you mix up GLArrayData usage with conventional GL array calls or in case of a buggy GL VBO implementation.- Specified by:
setEnableAlways
in interfaceGLArrayDataEditable
- See Also:
-
reset
public void reset()- Specified by:
reset
in interfaceGLArrayDataEditable
-
seal
public void seal(boolean seal) Description copied from interface: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.
- Specified by:
seal
in interfaceGLArrayDataEditable
- See Also:
-
rewind
public void rewind()- Specified by:
rewind
in interfaceGLArrayDataEditable
-
padding
public void padding(int doneInByteSize) - Specified by:
padding
in interfaceGLArrayDataEditable
-
put
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 interfaceGLArrayDataEditable
-
putb
public void putb(byte v) - Specified by:
putb
in interfaceGLArrayDataEditable
-
puts
public void puts(short v) - Specified by:
puts
in interfaceGLArrayDataEditable
-
puti
public void puti(int v) - Specified by:
puti
in interfaceGLArrayDataEditable
-
putx
public void putx(int v) - Specified by:
putx
in interfaceGLArrayDataEditable
-
putf
public void putf(float v) - Specified by:
putf
in interfaceGLArrayDataEditable
-
toString
- Specified by:
toString
in interfaceGLArrayData
- Overrides:
toString
in classGLArrayDataWrapper
-