aboutsummaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataWrapper.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/jogl/classes/com/jogamp/opengl/util/GLArrayDataWrapper.java')
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/GLArrayDataWrapper.java112
1 files changed, 56 insertions, 56 deletions
diff --git a/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataWrapper.java b/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataWrapper.java
index f8b17501e..290f47a6d 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataWrapper.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataWrapper.java
@@ -49,7 +49,7 @@ public class GLArrayDataWrapper implements GLArrayData {
/**
* Create a VBO, using a predefined fixed function array index, wrapping the given data.
- *
+ *
* @param index The GL array index
* @param comps The array component number
* @param dataType The array index GL data type
@@ -61,23 +61,23 @@ public class GLArrayDataWrapper implements GLArrayData {
* @param vboUsage {@link GL2ES2#GL_STREAM_DRAW}, {@link GL#GL_STATIC_DRAW} or {@link GL#GL_DYNAMIC_DRAW}
* @param vboTarget {@link GL#GL_ARRAY_BUFFER} or {@link GL#GL_ELEMENT_ARRAY_BUFFER}
* @return the new create instance
- *
+ *
* @throws GLException
*/
- public static GLArrayDataWrapper createFixed(int index, int comps, int dataType, boolean normalized, int stride,
+ public static GLArrayDataWrapper createFixed(int index, int comps, int dataType, boolean normalized, int stride,
Buffer buffer, int vboName, long vboOffset, int vboUsage, int vboTarget)
throws GLException
{
GLArrayDataWrapper adc = new GLArrayDataWrapper();
- adc.init(null, index, comps, dataType, normalized, stride, buffer, false,
+ adc.init(null, index, comps, dataType, normalized, stride, buffer, false,
vboName, vboOffset, vboUsage, vboTarget);
return adc;
}
/**
* Create a VBO, using a custom GLSL array attribute name, wrapping the given data.
- *
- * @param name The custom name for the GL attribute, maybe null if gpuBufferTarget is {@link GL#GL_ELEMENT_ARRAY_BUFFER}
+ *
+ * @param name The custom name for the GL attribute, maybe null if gpuBufferTarget is {@link GL#GL_ELEMENT_ARRAY_BUFFER}
* @param comps The array component number
* @param dataType The array index GL data type
* @param normalized Whether the data shall be normalized
@@ -90,7 +90,7 @@ public class GLArrayDataWrapper implements GLArrayData {
* @return the new create instance
* @throws GLException
*/
- public static GLArrayDataWrapper createGLSL(String name, int comps, int dataType, boolean normalized, int stride,
+ public static GLArrayDataWrapper createGLSL(String name, int comps, int dataType, boolean normalized, int stride,
Buffer buffer, int vboName, long vboOffset, int vboUsage, int vboTarget)
throws GLException
{
@@ -102,8 +102,8 @@ public class GLArrayDataWrapper implements GLArrayData {
/**
* Validates this instance's parameter. Called automatically by {@link GLArrayDataClient} and {@link GLArrayDataServer}.
- * {@link GLArrayDataWrapper} does not validate it's instance by itself.
- *
+ * {@link GLArrayDataWrapper} does not validate it's instance by itself.
+ *
* @param glp the GLProfile to use
* @param throwException whether to throw an exception if this instance has invalid parameter or not
* @return true if this instance has invalid parameter, otherwise false
@@ -113,7 +113,7 @@ public class GLArrayDataWrapper implements GLArrayData {
if(throwException) {
throw new GLException("Instance !alive "+this);
}
- return false;
+ return false;
}
if(this.isVertexAttribute() && !glp.hasGLSL()) {
if(throwException) {
@@ -123,13 +123,13 @@ public class GLArrayDataWrapper implements GLArrayData {
}
return glp.isValidArrayDataType(getIndex(), getComponentCount(), getComponentType(), isVertexAttribute(), throwException);
}
-
+
@Override
public void associate(Object obj, boolean enable) {
// nop
}
-
- //
+
+ //
// Data read access
//
@@ -150,14 +150,14 @@ public class GLArrayDataWrapper implements GLArrayData {
location = gl.glGetAttribLocation(program, name);
return location;
}
-
+
@Override
public final int setLocation(GL2ES2 gl, int program, int location) {
this.location = location;
gl.glBindAttribLocation(program, location, name);
return location;
}
-
+
@Override
public final String getName() { return name; }
@@ -172,10 +172,10 @@ public class GLArrayDataWrapper implements GLArrayData {
@Override
public final int getVBOUsage() { return vboEnabled?vboUsage:0; }
-
+
@Override
public final int getVBOTarget() { return vboEnabled?vboTarget:0; }
-
+
@Override
public final Buffer getBuffer() { return buffer; }
@@ -187,19 +187,19 @@ public class GLArrayDataWrapper implements GLArrayData {
@Override
public final int getComponentSizeInBytes() { return componentByteSize; }
-
+
@Override
public final int getElementCount() {
if(null==buffer) return 0;
return ( buffer.position()==0 ) ? ( buffer.limit() / components ) : ( buffer.position() / components ) ;
}
-
+
@Override
public final int getSizeInBytes() {
if(null==buffer) return 0;
- return ( buffer.position()==0 ) ? ( buffer.limit() * componentByteSize ) : ( buffer.position() * componentByteSize ) ;
+ return ( buffer.position()==0 ) ? ( buffer.limit() * componentByteSize ) : ( buffer.position() * componentByteSize ) ;
}
-
+
@Override
public final boolean getNormalized() { return normalized; }
@@ -223,18 +223,18 @@ public class GLArrayDataWrapper implements GLArrayData {
", index "+index+
", location "+location+
", isVertexAttribute "+isVertexAttribute+
- ", dataType 0x"+Integer.toHexString(componentType)+
- ", bufferClazz "+componentClazz+
+ ", dataType 0x"+Integer.toHexString(componentType)+
+ ", bufferClazz "+componentClazz+
", elements "+getElementCount()+
- ", components "+components+
+ ", components "+components+
", stride "+strideB+"b "+strideL+"c"+
- ", buffer "+buffer+
- ", vboEnabled "+vboEnabled+
- ", vboName "+vboName+
- ", vboUsage 0x"+Integer.toHexString(vboUsage)+
- ", vboTarget 0x"+Integer.toHexString(vboTarget)+
- ", vboOffset "+vboOffset+
- ", alive "+alive+
+ ", buffer "+buffer+
+ ", vboEnabled "+vboEnabled+
+ ", vboName "+vboName+
+ ", vboUsage 0x"+Integer.toHexString(vboUsage)+
+ ", vboTarget 0x"+Integer.toHexString(vboTarget)+
+ ", vboOffset "+vboOffset+
+ ", alive "+alive+
"]";
}
@@ -252,12 +252,12 @@ public class GLArrayDataWrapper implements GLArrayData {
return IntBuffer.class;
case GL.GL_FLOAT:
return FloatBuffer.class;
- default:
+ default:
throw new GLException("Given OpenGL data type not supported: "+dataType);
}
}
- @Override
+ @Override
public void setName(String newName) {
location = -1;
name = newName;
@@ -267,7 +267,7 @@ public class GLArrayDataWrapper implements GLArrayData {
* Enable or disable use of VBO.
* Only possible if a VBO buffer name is defined.
* @see #setVBOName(int)
- */
+ */
public void setVBOEnabled(boolean vboEnabled) {
this.vboEnabled=vboEnabled;
}
@@ -275,31 +275,31 @@ public class GLArrayDataWrapper implements GLArrayData {
/**
* Set the VBO buffer name, if valid (!= 0) enable use of VBO,
* otherwise (==0) disable VBO usage.
- *
+ *
* @see #setVBOEnabled(boolean)
- */
+ */
public void setVBOName(int vboName) {
this.vboName=vboName;
setVBOEnabled(0!=vboName);
}
- /**
+ /**
* @param vboUsage {@link GL2ES2#GL_STREAM_DRAW}, {@link GL#GL_STATIC_DRAW} or {@link GL#GL_DYNAMIC_DRAW}
- */
- public void setVBOUsage(int vboUsage) {
- this.vboUsage = vboUsage;
+ */
+ public void setVBOUsage(int vboUsage) {
+ this.vboUsage = vboUsage;
}
-
- /**
+
+ /**
* @param vboTarget either {@link GL#GL_ARRAY_BUFFER} or {@link GL#GL_ELEMENT_ARRAY_BUFFER}
- */
+ */
public void setVBOTarget(int vboTarget) {
this.vboTarget = vboTarget;
- }
+ }
- protected void init(String name, int index, int components, int componentType,
- boolean normalized, int stride, Buffer data,
- boolean isVertexAttribute,
+ protected void init(String name, int index, int components, int componentType,
+ boolean normalized, int stride, Buffer data,
+ boolean isVertexAttribute,
int vboName, long vboOffset, int vboUsage, int vboTarget)
throws GLException
{
@@ -307,19 +307,19 @@ public class GLArrayDataWrapper implements GLArrayData {
this.index = index;
this.location = -1;
// We can't have any dependence on the FixedFuncUtil class here for build bootstrapping reasons
-
+
if( GL.GL_ELEMENT_ARRAY_BUFFER == vboTarget ) {
// OK ..
} else if( ( 0 == vboUsage && 0 == vboTarget ) || GL.GL_ARRAY_BUFFER == vboTarget ) {
- // Set/Check name .. - Required for GLSL case. Validation and debug-name for FFP.
+ // Set/Check name .. - Required for GLSL case. Validation and debug-name for FFP.
this.name = ( null == name ) ? GLPointerFuncUtil.getPredefinedArrayIndexName(index) : name ;
if(null == this.name ) {
throw new GLException("Not a valid array buffer index: "+index);
- }
+ }
} else if( 0 < vboTarget ) {
throw new GLException("Invalid GPUBuffer target: 0x"+Integer.toHexString(vboTarget));
}
-
+
this.componentType = componentType;
componentClazz = getBufferClass(componentType);
if( GLBuffers.isGLTypeFixedPoint(componentType) ) {
@@ -329,7 +329,7 @@ public class GLArrayDataWrapper implements GLArrayData {
}
componentByteSize = GLBuffers.sizeOfGLType(componentType);
if(0 > componentByteSize) {
- throw new GLException("Given componentType not supported: "+componentType+":\n\t"+this);
+ throw new GLException("Given componentType not supported: "+componentType+":\n\t"+this);
}
if(0 >= components) {
throw new GLException("Invalid number of components: " + components);
@@ -348,7 +348,7 @@ public class GLArrayDataWrapper implements GLArrayData {
this.vboName= vboName;
this.vboEnabled= 0 != vboName ;
this.vboOffset=vboOffset;
-
+
switch(vboUsage) {
case 0: // nop
case GL.GL_STATIC_DRAW:
@@ -356,7 +356,7 @@ public class GLArrayDataWrapper implements GLArrayData {
case GL2ES2.GL_STREAM_DRAW:
break;
default:
- throw new GLException("invalid gpuBufferUsage: "+vboUsage+":\n\t"+this);
+ throw new GLException("invalid gpuBufferUsage: "+vboUsage+":\n\t"+this);
}
switch(vboTarget) {
case 0: // nop
@@ -367,7 +367,7 @@ public class GLArrayDataWrapper implements GLArrayData {
throw new GLException("invalid gpuBufferTarget: "+vboTarget+":\n\t"+this);
}
this.vboUsage=vboUsage;
- this.vboTarget=vboTarget;
+ this.vboTarget=vboTarget;
this.alive=true;
}
@@ -390,6 +390,6 @@ public class GLArrayDataWrapper implements GLArrayData {
protected int vboName;
protected boolean vboEnabled;
protected int vboUsage;
- protected int vboTarget;
+ protected int vboTarget;
}