Top Fields Constructors Methods
com.jogamp.opengl.util

public Class GLArrayDataClient

extends GLArrayDataWrapper
implements GLArrayDataEditable
Class Inheritance
All Implemented Interfaces
com.jogamp.opengl.util.GLArrayDataEditable, com.jogamp.opengl.GLArrayData
Known Direct Subclasses
com.jogamp.opengl.util.GLArrayDataServer
Imports
java.lang.reflect.Constructor, java.nio.Buffer, .ByteBuffer, .FloatBuffer, .IntBuffer, .ShortBuffer, com.jogamp.opengl.GL, .GLException, com.jogamp.opengl.fixedfunc.GLPointerFuncUtil, jogamp.opengl.util.GLArrayHandler, .GLFixedArrayHandler, jogamp.opengl.util.glsl.GLSLArrayHandler, com.jogamp.common.nio.Buffers, com.jogamp.opengl.util.glsl.ShaderState

Field Summary

Modifier and TypeField and Description
protected boolean
protected boolean
protected boolean
protected GLArrayHandler
protected int
private boolean
protected boolean
protected ShaderState
protected boolean
Inherited from com.jogamp.opengl.util.GLArrayDataWrapper:
alivebuffercomponentByteSizecomponentClazzcomponentsPerElementcomponentTypeDEBUGindexisVertexAttributelocationmappedElementCountnamenormalizedstrideBstrideLvboEnabledvboNamevboOffsetvboTargetvboUsage

Constructor Summary

AccessConstructor and Description
protected
public
GLArrayDataClient(final GLArrayDataClient src)

Copy Constructor

Buffer is sliced, i.e. sharing content but using own state.

Method Summary

Modifier and TypeMethod and Description
public void
associate(final Object
implementation and type dependent association
obj
,
final boolean
pass true to enable the association and false to disable it.
enable
)

Overrides com.jogamp.opengl.util.GLArrayDataWrapper.associate.

Implements com.jogamp.opengl.GLArrayData.associate.

Implementation and type dependent object association.
public boolean
bindBuffer(final GL
current GL object
gl
,
final boolean
true if VBO shall be bound and data written, otherwise clear VBO binding.
bind
)

Implements com.jogamp.opengl.util.GLArrayDataEditable.bindBuffer.

if bind is true and the data uses VBO, the latter will be bound and data written to the GPU if required.
protected final void
checkSeal(final boolean test)

public static GLArrayDataClient
createFixed(final int
The GL array index
index
,
final int
The array component number
comps
,
final int
The array index GL data type
dataType
,
final boolean
Whether the data shall be normalized
normalized
,
final 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.

public static GLArrayDataClient
createFixed(final int
The GL array index
index
,
final int
The array component number
comps
,
final int
The array index GL data type
dataType
,
final boolean
Whether the data shall be normalized
normalized
,
final int stride, final Buffer
the user define data
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.

public static GLArrayDataClient
createGLSL(final String
The custom name for the GL attribute.
name
,
final int
The array component number
comps
,
final int
The array index GL data type
dataType
,
final boolean
Whether the data shall be normalized
normalized
,
final 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

public static GLArrayDataClient
createGLSL(final String
The custom name for the GL attribute.
name
,
final int
The array component number
comps
,
final int
The array index GL data type
dataType
,
final boolean
Whether the data shall be normalized
normalized
,
final int stride, final Buffer
the user define data
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

public void
public void
enableBuffer(final GL gl, final boolean enable)

Implements com.jogamp.opengl.util.GLArrayDataEditable.enableBuffer.

Enables the buffer if enable is true, and transfers the data if required.
public final boolean
protected final void
growBuffer(int additionalElements)

protected final boolean
growBufferIfNecessary(final int spareComponents)

protected void
init(final String name, final int index, final int comps, final int dataType, final boolean normalized, final int stride, final Buffer data, final int initialElementCount, final int mappedElementCount, final boolean isVertexAttribute, final GLArrayHandler handler, final int vboName, final long vboOffset, final int vboUsage, final int vboTarget, final boolean usesGLSL)

protected void
init_vbo(final GL gl)

public final boolean
isVBOWritten()

Implements com.jogamp.opengl.util.GLArrayDataEditable.isVBOWritten.

Is the buffer written to the VBO ?
public void
public void
put(final Buffer v)

Implements com.jogamp.opengl.util.GLArrayDataEditable.put.

Generic buffer relative put method.
public void
public void
public void
public void
public void
public void
public void
public void
public void
seal(final GL gl, final boolean seal)

Implements com.jogamp.opengl.util.GLArrayDataEditable.seal.

Convenience method calling seal(boolean) and enableBuffer(GL, boolean).
public void
seal(final boolean seal)

Implements com.jogamp.opengl.util.GLArrayDataEditable.seal.

If seal is true, it disables write operations to the buffer.

public final boolean
public void
setEnableAlways(final boolean always)

Implements com.jogamp.opengl.util.GLArrayDataEditable.setEnableAlways.

Affects the behavior of 'enableBuffer'.
public final void
setVBOWritten(final boolean written)

Implements com.jogamp.opengl.util.GLArrayDataEditable.setVBOWritten.

Marks the buffer written to the VBO
public String
toString()

Overrides com.jogamp.opengl.util.GLArrayDataWrapper.toString.

Implements com.jogamp.opengl.GLArrayData.toString.

Returns a string representation of the object.
Inherited from com.jogamp.opengl.util.GLArrayDataWrapper:
createFixedcreateFixedcreateGLSLcreateGLSLgetBuffergetBufferClassgetBufferClassgetComponentCountgetComponentSizeInBytesgetComponentTypegetElementCountgetIndexgetLocationgetNamegetNormalizedgetSizeInBytesgetStridegetVBONamegetVBOOffsetgetVBOTargetgetVBOUsageinitisVBOisVertexAttributesetLocationsetLocationsetLocationsetNamesetVBOEnabledsetVBONamesetVBOTargetsetVBOUsagevalidate

Field Detail

bufferEnabledback to summary
protected boolean bufferEnabled
bufferWrittenback to summary
protected boolean bufferWritten
enableBufferAlwaysback to summary
protected boolean enableBufferAlways
glArrayHandlerback to summary
protected GLArrayHandler glArrayHandler
initialElementCountback to summary
protected int initialElementCount
isValidatedback to summary
private boolean isValidated
sealedback to summary
protected boolean sealed
shaderStateback to summary
protected ShaderState shaderState
usesGLSLback to summary
protected boolean usesGLSL

Constructor Detail

GLArrayDataClientback to summary
protected GLArrayDataClient()
GLArrayDataClientback to summary
public GLArrayDataClient(final GLArrayDataClient src)

Copy Constructor

Buffer is sliced, i.e. sharing content but using own state.

All other values are simply copied.

Method Detail

associateback to summary
public void associate(final Object obj, final boolean enable)

Overrides com.jogamp.opengl.util.GLArrayDataWrapper.associate.

Implements com.jogamp.opengl.GLArrayData.associate.

Doc from com.jogamp.opengl.GLArrayData.associate.

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 via shaderState.ownAttribute(GLArrayData, boolean).

Parameters
obj:Object

implementation and type dependent association

enable:boolean

pass true to enable the association and false to disable it.

Annotations
@Override
bindBufferback to summary
public boolean bindBuffer(final GL gl, final boolean bind)

Implements com.jogamp.opengl.util.GLArrayDataEditable.bindBuffer.

Doc from com.jogamp.opengl.util.GLArrayDataEditable.bindBuffer.

if 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 enableBuffer(GL, boolean), which leaves the VBO unbound, since it's not required for vertex attributes or pointers.

Parameters
gl:GL

current GL object

bind:boolean

true if VBO shall be bound and data written, otherwise clear VBO binding.

Returns:boolean

true if data uses VBO and action was performed, otherwise false

Annotations
@Override
checkSealback to summary
protected final void checkSeal(final boolean test) throws GLException
createFixedback to summary
public static GLArrayDataClient createFixed(final int index, final int comps, final int dataType, final boolean normalized, final 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, see GLPointerFuncUtil#getPredefinedArrayIndexName(int).

Parameters
index:int

The GL array index

comps:int

The array component number

dataType:int

The array index GL data type

normalized:boolean

Whether the data shall be normalized

See Also
com.jogamp.opengl.GLContext#getPredefinedArrayIndexName(int)
createFixedback to summary
public static GLArrayDataClient createFixed(final int index, final int comps, final int dataType, final boolean normalized, final int stride, final 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, see GLPointerFuncUtil#getPredefinedArrayIndexName(int).

Parameters
index:int

The GL array index

comps:int

The array component number

dataType:int

The array index GL data type

normalized:boolean

Whether the data shall be normalized

buffer:Buffer

the user define data

See Also
com.jogamp.opengl.GLContext#getPredefinedArrayIndexName(int)
createGLSLback to summary
public static GLArrayDataClient createGLSL(final String name, final int comps, final int dataType, final boolean normalized, final 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:String

The custom name for the GL attribute.

comps:int

The array component number

dataType:int

The array index GL data type

normalized:boolean

Whether the data shall be normalized

createGLSLback to summary
public static GLArrayDataClient createGLSL(final String name, final int comps, final int dataType, final boolean normalized, final int stride, final 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:String

The custom name for the GL attribute.

comps:int

The array component number

dataType:int

The array index GL data type

normalized:boolean

Whether the data shall be normalized

buffer:Buffer

the user define data

destroyback to summary
public void destroy(final GL gl)

Overrides com.jogamp.opengl.util.GLArrayDataWrapper.destroy.

Implements com.jogamp.opengl.util.GLArrayDataEditable.destroy, com.jogamp.opengl.GLArrayData.destroy.

Annotations
@Override
enableBufferback to summary
public void enableBuffer(final GL gl, final boolean enable)

Implements com.jogamp.opengl.util.GLArrayDataEditable.enableBuffer.

Doc from com.jogamp.opengl.util.GLArrayDataEditable.enableBuffer.

Enables the buffer if 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 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.

Annotations
@Override
enabledback to summary
public final boolean enabled()

Implements com.jogamp.opengl.util.GLArrayDataEditable.enabled.

Annotations
@Override
growBufferback to summary
protected final void growBuffer(int additionalElements)
growBufferIfNecessaryback to summary
protected final boolean growBufferIfNecessary(final int spareComponents)
initback to summary
protected void init(final String name, final int index, final int comps, final int dataType, final boolean normalized, final int stride, final Buffer data, final int initialElementCount, final int mappedElementCount, final boolean isVertexAttribute, final GLArrayHandler handler, final int vboName, final long vboOffset, final int vboUsage, final int vboTarget, final boolean usesGLSL) throws GLException
init_vboback to summary
protected void init_vbo(final GL gl)
isVBOWrittenback to summary
public final boolean isVBOWritten()

Implements com.jogamp.opengl.util.GLArrayDataEditable.isVBOWritten.

Doc from com.jogamp.opengl.util.GLArrayDataEditable.isVBOWritten.

Is the buffer written to the VBO ?

Annotations
@Override
paddingback to summary
public void padding(int doneInByteSize)

Implements com.jogamp.opengl.util.GLArrayDataEditable.padding.

Annotations
@Override
putback to summary
public void put(final Buffer v)

Implements com.jogamp.opengl.util.GLArrayDataEditable.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.

Annotations
@Override
putbback to summary
public void putb(final byte v)

Implements com.jogamp.opengl.util.GLArrayDataEditable.putb.

Annotations
@Override
putfback to summary
public void putf(final float v)

Implements com.jogamp.opengl.util.GLArrayDataEditable.putf.

Annotations
@Override
putiback to summary
public void puti(final int v)

Implements com.jogamp.opengl.util.GLArrayDataEditable.puti.

Annotations
@Override
putsback to summary
public void puts(final short v)

Implements com.jogamp.opengl.util.GLArrayDataEditable.puts.

Annotations
@Override
putxback to summary
public void putx(final int v)

Implements com.jogamp.opengl.util.GLArrayDataEditable.putx.

Annotations
@Override
resetback to summary
public void reset(final GL gl)

Implements com.jogamp.opengl.util.GLArrayDataEditable.reset.

Annotations
@Override
resetback to summary
public void reset()

Implements com.jogamp.opengl.util.GLArrayDataEditable.reset.

Annotations
@Override
rewindback to summary
public void rewind()

Implements com.jogamp.opengl.util.GLArrayDataEditable.rewind.

Annotations
@Override
sealback to summary
public void seal(final GL gl, final boolean seal)

Implements com.jogamp.opengl.util.GLArrayDataEditable.seal.

Doc from com.jogamp.opengl.util.GLArrayDataEditable.seal.

Convenience method calling seal(boolean) and enableBuffer(GL, boolean).

Annotations
@Override
sealback to summary
public void seal(final boolean seal)

Implements com.jogamp.opengl.util.GLArrayDataEditable.seal.

Doc from com.jogamp.opengl.util.GLArrayDataEditable.seal.

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.

Annotations
@Override
sealedback to summary
public final boolean sealed()

Implements com.jogamp.opengl.util.GLArrayDataEditable.sealed.

Annotations
@Override
setEnableAlwaysback to summary
public void setEnableAlways(final boolean always)

Implements com.jogamp.opengl.util.GLArrayDataEditable.setEnableAlways.

Doc from com.jogamp.opengl.util.GLArrayDataEditable.setEnableAlways.

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.

Annotations
@Override
setVBOWrittenback to summary
public final void setVBOWritten(final boolean written)

Implements com.jogamp.opengl.util.GLArrayDataEditable.setVBOWritten.

Doc from com.jogamp.opengl.util.GLArrayDataEditable.setVBOWritten.

Marks the buffer written to the VBO

Annotations
@Override
toStringback to summary
public String toString()

Overrides com.jogamp.opengl.util.GLArrayDataWrapper.toString.

Implements com.jogamp.opengl.GLArrayData.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object

Annotations
@Override