Class GLArrayDataServer
- java.lang.Object
-
- com.jogamp.opengl.util.GLArrayDataWrapper
-
- com.jogamp.opengl.util.GLArrayDataClient
-
- com.jogamp.opengl.util.GLArrayDataServer
-
- All Implemented Interfaces:
GLArrayData,GLArrayDataEditable
public class GLArrayDataServer extends GLArrayDataClient implements GLArrayDataEditable
-
-
Field Summary
-
Fields inherited from class com.jogamp.opengl.util.GLArrayDataClient
DEFAULT_GROWTH_FACTOR
-
Fields inherited from class com.jogamp.opengl.util.GLArrayDataWrapper
DEBUG
-
-
Constructor Summary
Constructors Constructor Description GLArrayDataServer(GLArrayDataServer src)Copy Constructor
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description GLArrayDataaddFixedSubArray(int index, int comps, int vboTarget)Configure a segment of this fixed function interleaved array (seecreateFixedInterleaved(int, int, boolean, int, int)).GLArrayDataWrapperaddGLSLSubArray(String name, int comps, int vboTarget)Configure a segment of this GLSL interleaved array (seecreateGLSLInterleaved(int, int, boolean, int, int)).static GLArrayDataServercreateData(int compsPerElement, int dataType, int initialElementCount, int vboUsage, int vboTarget)Create a VBO data object for any target w/o render pipeline association, ieGL.GL_ELEMENT_ARRAY_BUFFER.static GLArrayDataServercreateData(int compsPerElement, int dataType, int stride, Buffer buffer, int vboUsage, int vboTarget)Create a VBO data object for any target w/o render pipeline association, ieGL.GL_ELEMENT_ARRAY_BUFFER.static GLArrayDataServercreateDataMapped(int compsPerElement, int dataType, int mappedElementCount, int vboUsage, int vboTarget)Create a VBO data object for any target w/o render pipeline association, i.e.static GLArrayDataServercreateFixed(int index, int compsPerElement, int dataType, boolean normalized, int initialElementCount, int vboUsage)Create a VBO, 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 GLArrayDataServercreateFixed(int index, int compsPerElement, 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 GLArrayDataServercreateFixedInterleaved(int compsPerElement, int dataType, boolean normalized, int initialElementCount, int vboUsage)Create a VBO for fixed function interleaved array data starting with a new created Buffer object with initialElementCount size.static GLArrayDataServercreateFixedInterleaved(int compsPerElement, int dataType, boolean normalized, int stride, Buffer buffer, int vboUsage)Create a VBO for fixed function interleaved array data starting with a given Buffer object incl it's stridestatic GLArrayDataServercreateFixedInterleavedMapped(int compsPerElement, int dataType, boolean normalized, int mappedElementCount, int vboUsage)Create a VBO for fixed function interleaved array data intended for GPU buffer storage mapping, seeGLBufferStorage, viamapStorage(GL, int)andmapStorage(GL, long, long, int).static GLArrayDataServercreateGLSL(String name, int compsPerElement, int dataType, boolean normalized, int initialElementCount, int vboUsage)Create a VBO, using a custom GLSL array attribute name and starting with a new created Buffer object with initialElementCount sizestatic GLArrayDataServercreateGLSL(String name, int compsPerElement, 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 stridestatic GLArrayDataServercreateGLSLInterleaved(int compsPerElement, int dataType, boolean normalized, int initialElementCount, int vboUsage)Create a VBO for GLSL interleaved array data starting with a new created Buffer object with initialElementCount size.static GLArrayDataServercreateGLSLInterleaved(int compsPerElement, int dataType, boolean normalized, int stride, Buffer buffer, int vboUsage)Create a VBO for GLSL interleaved array data starting with a given Buffer object incl it's stridestatic GLArrayDataServercreateGLSLInterleavedMapped(int compsPerElement, int dataType, boolean normalized, int mappedElementCount, int vboUsage)Create a VBO for GLSL interleaved array data intended for GPU buffer storage mapping, seeGLBufferStorage, viamapStorage(GL, int)andmapStorage(GL, long, long, int).static GLArrayDataServercreateGLSLMapped(String name, int compsPerElement, int dataType, boolean normalized, int mappedElementCount, int vboUsage)Create a VBO, using a custom GLSL array attribute name intended for GPU buffer storage mapping, seeGLBufferStorage, viamapStorage(GL, int)andmapStorage(GL, long, long, int).voiddestroy(GL gl)intgetInterleavedOffset()GLBufferStoragemapStorage(GL gl, int access)GLBufferStoragemapStorage(GL gl, long offset, long length, int access)voidsetInterleavedOffset(int interleavedOffset)voidsetVBOEnabled(boolean vboUsage)Convenient way do disable the VBO behavior and switch to client side data one Only possible if buffer is defined.StringtoString()voidunmapStorage(GL gl)-
Methods inherited from class com.jogamp.opengl.util.GLArrayDataClient
associate, bindBuffer, clear, clear, compsToElemCount, createFixed, createFixed, createGLSL, createGLSL, enableBuffer, enabled, getGrowthFactor, growIfNeeded, isVBOWritten, padding, put, put3b, put3f, put3i, put3s, put4b, put4f, put4i, put4s, putb, putb, putf, putf, puti, puti, puts, puts, putx, reserve, rewind, seal, seal, setEnableAlways, setGrowthFactor, setVBOWritten
-
Methods inherited from class com.jogamp.opengl.util.GLArrayDataWrapper
bytePosition, createFixed, createFixed, createGLSL, createGLSL, elemPosition, elemStatsToString, fillStatsToString, getBuffer, getBufferClass, getBufferClass, getByteCapacity, getByteCount, getBytesPerComp, getCompsPerElem, getCompType, getElemCapacity, getElemCount, getIndex, getLocation, getName, getNormalized, getStride, getVBOName, getVBOOffset, getVBOTarget, getVBOUsage, isVBO, isVertexAttribute, remainingBytes, remainingElems, sealed, setLocation, setLocation, 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.GLArrayData
associate, bytePosition, elemPosition, elemStatsToString, fillStatsToString, getBuffer, getByteCapacity, getByteCount, getBytesPerComp, getCompsPerElem, getCompType, getElemCapacity, getElemCount, getIndex, getLocation, getName, getNormalized, getStride, getVBOName, getVBOOffset, getVBOTarget, getVBOUsage, isVBO, isVertexAttribute, remainingBytes, remainingElems, sealed, setLocation, setLocation, setLocation, setName
-
Methods inherited from interface com.jogamp.opengl.util.GLArrayDataEditable
bindBuffer, clear, clear, enableBuffer, enabled, isVBOWritten, padding, put, put3b, put3f, put3i, put3s, put4b, put4f, put4i, put4s, putb, putb, putf, putf, puti, puti, puts, puts, putx, rewind, seal, seal, setEnableAlways, setVBOWritten
-
-
-
-
Constructor Detail
-
GLArrayDataServer
public GLArrayDataServer(GLArrayDataServer src)
Copy ConstructorBuffer is
sliced, i.e. sharing content but using own state.All other values are simply copied.
-
-
Method Detail
-
createFixed
public static GLArrayDataServer createFixed(int index, int compsPerElement, 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, seeGLPointerFuncUtil.getPredefinedArrayIndexName(int).- Parameters:
index- The GL array indexcompsPerElement- component count per elementdataType- The component's OpenGL data typenormalized- Whether the data shall be normalizedstride- in bytes from one element to the other. If zero, compsPerElement * compSizeInBytesbuffer- the user define datavboUsage-GL2ES2.GL_STREAM_DRAW,GL.GL_STATIC_DRAWorGL.GL_DYNAMIC_DRAW- Throws:
GLException- See Also:
com.jogamp.opengl.GLContext#getPredefinedArrayIndexName(int)
-
createFixed
public static GLArrayDataServer createFixed(int index, int compsPerElement, int dataType, boolean normalized, int initialElementCount, int vboUsage) throws GLException
Create a VBO, 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 indexcompsPerElement- component count per elementdataType- The component's OpenGL data typenormalized- Whether the data shall be normalizedinitialElementCount-vboUsage-GL2ES2.GL_STREAM_DRAW,GL.GL_STATIC_DRAWorGL.GL_DYNAMIC_DRAW- Throws:
GLException- See Also:
com.jogamp.opengl.GLContext#getPredefinedArrayIndexName(int)
-
createGLSL
public static GLArrayDataServer createGLSL(String name, int compsPerElement, int dataType, boolean normalized, int initialElementCount, int vboUsage) throws GLException
Create a VBO, 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 attributecompsPerElement- component count per elementdataType- The component's OpenGL data typenormalized- Whether the data shall be normalizedinitialElementCount-vboUsage-GL2ES2.GL_STREAM_DRAW,GL.GL_STATIC_DRAWorGL.GL_DYNAMIC_DRAW- Throws:
GLException
-
createGLSLMapped
public static GLArrayDataServer createGLSLMapped(String name, int compsPerElement, int dataType, boolean normalized, int mappedElementCount, int vboUsage) throws GLException
Create a VBO, using a custom GLSL array attribute name intended for GPU buffer storage mapping, seeGLBufferStorage, viamapStorage(GL, int)andmapStorage(GL, long, long, int).- Parameters:
name- The custom name for the GL attributecompsPerElement- component count per elementdataType- The component's OpenGL data typenormalized- Whether the data shall be normalizedmappedElementCount-vboUsage-GL2ES2.GL_STREAM_DRAW,GL.GL_STATIC_DRAWorGL.GL_DYNAMIC_DRAW- Throws:
GLException
-
createGLSL
public static GLArrayDataServer createGLSL(String name, int compsPerElement, 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 attributecompsPerElement- component count per elementdataType- The component's OpenGL data typenormalized- Whether the data shall be normalizedstride- in bytes from one element to the other. If zero, compsPerElement * compSizeInBytesbuffer- the user define datavboUsage-GL2ES2.GL_STREAM_DRAW,GL.GL_STATIC_DRAWorGL.GL_DYNAMIC_DRAW- Throws:
GLException
-
createData
public static GLArrayDataServer createData(int compsPerElement, 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, ieGL.GL_ELEMENT_ARRAY_BUFFER. Hence no index, name for a fixed function pipeline nor vertex attribute is given.- Parameters:
compsPerElement- component count per elementdataType- The component's OpenGL data typestride- in bytes from one element to the other. If zero, compsPerElement * compSizeInBytesbuffer- the user define datavboUsage-GL2ES2.GL_STREAM_DRAW,GL.GL_STATIC_DRAWorGL.GL_DYNAMIC_DRAWvboTarget-GL.GL_ELEMENT_ARRAY_BUFFER, ..GL.glGenBuffers(int, int[], int)- Throws:
GLException
-
createData
public static GLArrayDataServer createData(int compsPerElement, int dataType, int initialElementCount, int vboUsage, int vboTarget) throws GLException
Create a VBO data object for any target w/o render pipeline association, ieGL.GL_ELEMENT_ARRAY_BUFFER. Hence no index, name for a fixed function pipeline nor vertex attribute is given.- Parameters:
compsPerElement- component count per elementdataType- The component's OpenGL data typeinitialElementCount-vboUsage-GL2ES2.GL_STREAM_DRAW,GL.GL_STATIC_DRAWorGL.GL_DYNAMIC_DRAWvboTarget-GL.GL_ELEMENT_ARRAY_BUFFER, ..- Throws:
GLException
-
createDataMapped
public static GLArrayDataServer createDataMapped(int compsPerElement, int dataType, int mappedElementCount, int vboUsage, int vboTarget) throws GLException
Create a VBO data object for any target w/o render pipeline association, i.e.GL.GL_ELEMENT_ARRAY_BUFFER, intended for GPU buffer storage mapping, seeGLBufferStorage, viamapStorage(GL, int)andmapStorage(GL, long, long, int).No index, name for a fixed function pipeline nor vertex attribute is given.
- Parameters:
compsPerElement- component count per elementdataType- The component's OpenGL data typemappedElementCount-vboUsage-GL2ES2.GL_STREAM_DRAW,GL.GL_STATIC_DRAWorGL.GL_DYNAMIC_DRAWvboTarget-GL.GL_ELEMENT_ARRAY_BUFFER, ..- Throws:
GLException
-
createFixedInterleaved
public static GLArrayDataServer createFixedInterleaved(int compsPerElement, int dataType, boolean normalized, int initialElementCount, int vboUsage) throws GLException
Create a VBO for fixed function interleaved array data starting with a new created Buffer object with initialElementCount size.User needs to configure the interleaved segments via
addFixedSubArray(int, int, int).- Parameters:
compsPerElement- The total number of all interleaved components per element.dataType- The component's OpenGL data typenormalized- Whether the data shall be normalizedinitialElementCount- The initial number of all interleaved elementsvboUsage-GL2ES2.GL_STREAM_DRAW,GL.GL_STATIC_DRAWorGL.GL_DYNAMIC_DRAW- Throws:
GLException
-
createFixedInterleavedMapped
public static GLArrayDataServer createFixedInterleavedMapped(int compsPerElement, int dataType, boolean normalized, int mappedElementCount, int vboUsage) throws GLException
Create a VBO for fixed function interleaved array data intended for GPU buffer storage mapping, seeGLBufferStorage, viamapStorage(GL, int)andmapStorage(GL, long, long, int).User needs to configure the interleaved segments via
addFixedSubArray(int, int, int).- Parameters:
compsPerElement- The total number of all interleaved components per element.dataType- The component's OpenGL data typenormalized- Whether the data shall be normalizedmappedElementCount- The total number of all interleaved elementsvboUsage-GL2ES2.GL_STREAM_DRAW,GL.GL_STATIC_DRAWorGL.GL_DYNAMIC_DRAW- Throws:
GLException
-
createFixedInterleaved
public static GLArrayDataServer createFixedInterleaved(int compsPerElement, int dataType, boolean normalized, int stride, Buffer buffer, int vboUsage) throws GLException
Create a VBO for fixed function interleaved array data starting with a given Buffer object incl it's strideUser needs to configure the interleaved segments via
addFixedSubArray(int, int, int).- Parameters:
compsPerElement- The total number of all interleaved components per element.dataType- The component's OpenGL data typenormalized- Whether the data shall be normalizedstride- in bytes from one element of a sub-array to the other. If zero, compsPerElement * compSizeInBytesbuffer- The user define data of all interleaved elementsvboUsage-GL2ES2.GL_STREAM_DRAW,GL.GL_STATIC_DRAWorGL.GL_DYNAMIC_DRAW- Throws:
GLException
-
addFixedSubArray
public GLArrayData addFixedSubArray(int index, int comps, int vboTarget)
Configure a segment of this fixed function interleaved array (seecreateFixedInterleaved(int, int, boolean, int, int)).This method may be called several times as long the sum of interleaved components does not exceed the total component count 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 isGL.GL_ELEMENT_ARRAY_BUFFERcomps- This interleaved array segment's component count per elementvboTarget-GL.GL_ARRAY_BUFFERorGL.GL_ELEMENT_ARRAY_BUFFER
-
createGLSLInterleaved
public static GLArrayDataServer createGLSLInterleaved(int compsPerElement, int dataType, boolean normalized, int initialElementCount, int vboUsage) throws GLException
Create a VBO for GLSL interleaved array data starting with a new created Buffer object with initialElementCount size.User needs to configure the interleaved segments via
#addGLSLSubArray(int, int, int).- Parameters:
compsPerElement- The total number of all interleaved components per element.dataType- The component's OpenGL data typenormalized- Whether the data shall be normalizedinitialElementCount- The initial number of all interleaved elementsvboUsage-GL2ES2.GL_STREAM_DRAW,GL.GL_STATIC_DRAWorGL.GL_DYNAMIC_DRAW- Throws:
GLException
-
createGLSLInterleavedMapped
public static GLArrayDataServer createGLSLInterleavedMapped(int compsPerElement, int dataType, boolean normalized, int mappedElementCount, int vboUsage) throws GLException
Create a VBO for GLSL interleaved array data intended for GPU buffer storage mapping, seeGLBufferStorage, viamapStorage(GL, int)andmapStorage(GL, long, long, int).User needs to configure the interleaved segments via
#addGLSLSubArray(int, int, int).- Parameters:
compsPerElement- The total number of all interleaved components per element.dataType- The component's OpenGL data typenormalized- Whether the data shall be normalizedmappedElementCount- The total number of all interleaved elementsvboUsage-GL2ES2.GL_STREAM_DRAW,GL.GL_STATIC_DRAWorGL.GL_DYNAMIC_DRAW- Throws:
GLException
-
createGLSLInterleaved
public static GLArrayDataServer createGLSLInterleaved(int compsPerElement, int dataType, boolean normalized, int stride, Buffer buffer, int vboUsage) throws GLException
Create a VBO for GLSL interleaved array data starting with a given Buffer object incl it's strideUser needs to configure the interleaved segments via
#addGLSLSubArray(int, int, int).- Parameters:
compsPerElement- The total number of all interleaved components per element.dataType- The component's OpenGL data typenormalized- Whether the data shall be normalizedstride- in bytes from one element of a sub-array to the other. If zero, compsPerElement * compSizeInBytesbuffer- The user define data of all interleaved elementsvboUsage-GL2ES2.GL_STREAM_DRAW,GL.GL_STATIC_DRAWorGL.GL_DYNAMIC_DRAW- Throws:
GLException
-
addGLSLSubArray
public GLArrayDataWrapper addGLSLSubArray(String name, int comps, int vboTarget)
Configure a segment of this GLSL interleaved array (seecreateGLSLInterleaved(int, int, boolean, int, int)).This method may be called several times as long the sum of interleaved components does not exceed the total component count 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 isGL.GL_ELEMENT_ARRAY_BUFFERcomps- This interleaved array segment's component count per elementvboTarget-GL.GL_ARRAY_BUFFERorGL.GL_ELEMENT_ARRAY_BUFFER
-
setInterleavedOffset
public final void setInterleavedOffset(int interleavedOffset)
-
getInterleavedOffset
public final int getInterleavedOffset()
-
destroy
public void destroy(GL gl)
- Specified by:
destroyin interfaceGLArrayData- Specified by:
destroyin interfaceGLArrayDataEditable- Overrides:
destroyin classGLArrayDataClient
-
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:
setVBOEnabledin classGLArrayDataWrapper- See Also:
GLArrayDataWrapper.setVBOName(int)
-
mapStorage
public GLBufferStorage mapStorage(GL gl, int access)
-
mapStorage
public GLBufferStorage mapStorage(GL gl, long offset, long length, int access)
-
unmapStorage
public void unmapStorage(GL gl)
-
toString
public String toString()
- Specified by:
toStringin interfaceGLArrayData- Overrides:
toStringin classGLArrayDataClient
-
-