summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2011-08-01 20:14:26 +0200
committerSven Gothel <[email protected]>2011-08-01 20:14:26 +0200
commit76f7552c4a219b116e86949f271e613ba0f6f160 (patch)
tree8add94c952abb4f802129a0768962debf015ec7f /src
parent6b82b5758d63f4cdb1028e07fc84c5f7a45d3d70 (diff)
Cont. fix 'Allow VBO/Texture Name (int) < 0'
Refines spec GLArrayData and it's implementations. see commit 4d33a2df1e991ab75817dcb44061d88d3c499cdb see commit 2dbd16fc3edf29b39ba37a11b9fbf1b2aad75c45
Diffstat (limited to 'src')
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/GLArrayDataClient.java8
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/GLArrayDataServer.java8
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/GLArrayDataWrapper.java16
-rw-r--r--src/jogl/classes/javax/media/opengl/GLArrayData.java12
-rw-r--r--src/jogl/classes/jogamp/opengl/GLBufferStateTracker.java44
-rw-r--r--src/jogl/classes/jogamp/opengl/util/glsl/fixedfunc/FixedFuncHook.java8
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/RedSquare0.java4
7 files changed, 50 insertions, 50 deletions
diff --git a/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataClient.java b/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataClient.java
index d80d398aa..4296ebee2 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataClient.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataClient.java
@@ -52,7 +52,7 @@ public class GLArrayDataClient extends GLArrayDataWrapper implements GLArrayData
{
GLArrayDataClient adc = new GLArrayDataClient();
GLArrayHandler glArrayHandler = new GLFixedArrayHandler(adc);
- adc.init(name, index, comps, dataType, normalized, 0, null, initialSize, false, glArrayHandler, -1, -1, -1, -1);
+ adc.init(name, index, comps, dataType, normalized, 0, null, initialSize, false, glArrayHandler, 0, 0, 0, 0);
return adc;
}
@@ -83,7 +83,7 @@ public class GLArrayDataClient extends GLArrayDataWrapper implements GLArrayData
{
GLArrayDataClient adc = new GLArrayDataClient();
GLArrayHandler glArrayHandler = new GLFixedArrayHandler(adc);
- adc.init(name, index, comps, dataType, normalized, stride, buffer, comps*comps, false, glArrayHandler, -1, -1, -1, -1);
+ adc.init(name, index, comps, dataType, normalized, stride, buffer, comps*comps, false, glArrayHandler, 0, 0, 0, 0);
return adc;
}
@@ -104,7 +104,7 @@ public class GLArrayDataClient extends GLArrayDataWrapper implements GLArrayData
{
GLArrayDataClient adc = new GLArrayDataClient();
GLArrayHandler glArrayHandler = new GLSLArrayHandler(st, adc);
- adc.init(name, -1, comps, dataType, normalized, 0, null, initialSize, true, glArrayHandler, -1, -1, -1, -1);
+ adc.init(name, -1, comps, dataType, normalized, 0, null, initialSize, true, glArrayHandler, 0, 0, 0, 0);
return adc;
}
@@ -127,7 +127,7 @@ public class GLArrayDataClient extends GLArrayDataWrapper implements GLArrayData
{
GLArrayDataClient adc = new GLArrayDataClient();
GLArrayHandler glArrayHandler = new GLSLArrayHandler(st, adc);
- adc.init(name, -1, comps, dataType, normalized, stride, buffer, comps*comps, true, glArrayHandler, -1, -1, -1, -1);
+ adc.init(name, -1, comps, dataType, normalized, stride, buffer, comps*comps, true, glArrayHandler, 0, 0, 0, 0);
return adc;
}
diff --git a/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataServer.java b/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataServer.java
index 23c237909..b244184b0 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataServer.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataServer.java
@@ -216,16 +216,16 @@ public class GLArrayDataServer extends GLArrayDataClient implements GLArrayDataE
", elements "+getElementNumber()+
", components "+components+
", stride "+stride+"u "+strideB+"b "+strideL+"c"+
- ", initialSize "+initialSize+
- ", vboUsage 0x"+Integer.toHexString(vboUsage)+
- ", vboTarget 0x"+Integer.toHexString(vboTarget)+
+ ", initialSize "+initialSize+
", vboEnabled "+vboEnabled+
", vboName "+vboName+
+ ", vboUsage 0x"+Integer.toHexString(vboUsage)+
+ ", vboTarget 0x"+Integer.toHexString(vboTarget)+
+ ", vboOffset 0x"+Long.toHexString(vboOffset)+
", sealed "+sealed+
", bufferEnabled "+bufferEnabled+
", bufferWritten "+bufferWritten+
", buffer "+buffer+
- ", offset "+vboOffset+
", alive "+alive+
"]";
}
diff --git a/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataWrapper.java b/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataWrapper.java
index 5f0c9b8db..798e1bca3 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataWrapper.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataWrapper.java
@@ -102,15 +102,15 @@ public class GLArrayDataWrapper implements GLArrayData {
public final String getName() { return name; }
- public final long getVBOOffset() { return vboEnabled?vboOffset:-1; }
+ public final long getVBOOffset() { return vboEnabled?vboOffset:0; }
- public final int getVBOName() { return vboEnabled?vboName:-1; }
+ public final int getVBOName() { return vboEnabled?vboName:0; }
public final boolean isVBO() { return vboEnabled; }
- public final int getVBOUsage() { return vboEnabled?vboUsage:-1; }
+ public final int getVBOUsage() { return vboEnabled?vboUsage:0; }
- public final int getVBOTarget() { return vboEnabled?vboTarget:-1; }
+ public final int getVBOTarget() { return vboEnabled?vboTarget:0; }
public final Buffer getBuffer() { return buffer; }
@@ -139,7 +139,7 @@ public class GLArrayDataWrapper implements GLArrayData {
buffer = null;
vboName=0;
vboEnabled=false;
- vboOffset=-1;
+ vboOffset=0;
alive = false;
}
@@ -154,11 +154,11 @@ public class GLArrayDataWrapper implements GLArrayData {
", components "+components+
", stride "+stride+"u "+strideB+"b "+strideL+"c"+
", buffer "+buffer+
- ", offset "+vboOffset+
- ", vboUsage 0x"+Integer.toHexString(vboUsage)+
- ", vboTarget 0x"+Integer.toHexString(vboTarget)+
", vboEnabled "+vboEnabled+
", vboName "+vboName+
+ ", vboUsage 0x"+Integer.toHexString(vboUsage)+
+ ", vboTarget 0x"+Integer.toHexString(vboTarget)+
+ ", vboOffset 0x"+Long.toHexString(vboOffset)+
", alive "+alive+
"]";
}
diff --git a/src/jogl/classes/javax/media/opengl/GLArrayData.java b/src/jogl/classes/javax/media/opengl/GLArrayData.java
index 448ddd10c..4562c1c0b 100644
--- a/src/jogl/classes/javax/media/opengl/GLArrayData.java
+++ b/src/jogl/classes/javax/media/opengl/GLArrayData.java
@@ -86,24 +86,24 @@ public interface GLArrayData {
public boolean isVBO();
/**
- * The VBO buffer offset or -1 if not a VBO
+ * The VBO buffer offset or 0 if not a VBO
*/
public long getVBOOffset();
/**
- * The VBO name or -1 if not a VBO
+ * The VBO name or 0 if not a VBO
*/
public int getVBOName();
/**
- * The VBO usage or -1 if not a VBO
- * @return -1 if not a GPU buffer, otherwise {@link GL2ES2#GL_STREAM_DRAW}, {@link GL#GL_STATIC_DRAW} or {@link GL#GL_DYNAMIC_DRAW}
+ * The VBO usage or 0 if not a VBO
+ * @return 0 if not a GPU buffer, otherwise {@link GL2ES2#GL_STREAM_DRAW}, {@link GL#GL_STATIC_DRAW} or {@link GL#GL_DYNAMIC_DRAW}
*/
public int getVBOUsage();
/**
- * The VBO target or -1 if not a VBO
- * @return -1 if not a GPU buffer, otherwise {@link GL#GL_ARRAY_BUFFER} or {@link GL#GL_ELEMENT_ARRAY_BUFFER}
+ * The VBO target or 0 if not a VBO
+ * @return 0 if not a GPU buffer, otherwise {@link GL#GL_ARRAY_BUFFER} or {@link GL#GL_ELEMENT_ARRAY_BUFFER}
*/
public int getVBOTarget();
diff --git a/src/jogl/classes/jogamp/opengl/GLBufferStateTracker.java b/src/jogl/classes/jogamp/opengl/GLBufferStateTracker.java
index c7e27da2a..1e5dc6069 100644
--- a/src/jogl/classes/jogamp/opengl/GLBufferStateTracker.java
+++ b/src/jogl/classes/jogamp/opengl/GLBufferStateTracker.java
@@ -40,8 +40,6 @@
package jogamp.opengl;
-import java.util.HashMap;
-
import javax.media.opengl.*;
import com.jogamp.common.util.IntIntHashMap;
@@ -100,14 +98,15 @@ public class GLBufferStateTracker {
setBoundBufferObject(GL2.GL_PIXEL_UNPACK_BUFFER, 0);
}
- public final void setBoundBufferObject(int target, int buffer) {
- bindingMap.put(target, buffer);
- if (DEBUG) {
- System.err.println();
- System.err.println("GLBufferStateTracker.setBoundBufferObject(): mapped bound buffer 0x" +
- Integer.toHexString(buffer) + " for query target 0x" + Integer.toHexString(target));
- Thread.dumpStack();
- }
+ public final void setBoundBufferObject(int target, int value) {
+ bindingMap.put(target, value);
+ if (DEBUG) {
+ System.err.println();
+ System.err.println("GLBufferStateTracker.setBoundBufferObject() target 0x" +
+ Integer.toHexString(target) + " -> mapped bound buffer 0x" +
+ Integer.toHexString(value));
+ // Thread.dumpStack();
+ }
}
/** Note: returns an unspecified value if the binding for the
@@ -131,23 +130,24 @@ public class GLBufferStateTracker {
}
if (gotQueryTarget) {
caller.glGetIntegerv(queryTarget, bufTmp, 0);
+ value = bufTmp[0];
if (DEBUG) {
System.err.println();
- System.err.println("GLBufferStateTracker.getBoundBufferObject(): queried bound buffer 0x" +
- Integer.toHexString(bufTmp[0]) +
- " for target 0x" + Integer.toHexString(target)+" / query 0x"+Integer.toHexString(queryTarget));
+ System.err.println("GLBufferStateTracker.getBoundBufferObject() [queried value]: target 0x" +
+ Integer.toHexString(target) + " / query 0x"+Integer.toHexString(queryTarget)+
+ " -> mapped bound buffer 0x" + Integer.toHexString(value));
}
- setBoundBufferObject(target, bufTmp[0]);
- return bufTmp[0];
+ setBoundBufferObject(target, value);
+ return value;
}
return 0;
}
- if (DEBUG) {
- System.err.println();
- System.err.println("GLBufferStateTracker.getBoundBufferObject(): mapped bound buffer 0x" +
- Integer.toHexString(value) + " for query target 0x" + Integer.toHexString(target));
- Thread.dumpStack();
- }
+ if (DEBUG) {
+ System.err.println();
+ System.err.println("GLBufferStateTracker.getBoundBufferObject() [mapped value]: target 0x" +
+ Integer.toHexString(target) + " -> mapped bound buffer 0x" +
+ Integer.toHexString(value));
+ }
return value;
}
@@ -163,7 +163,7 @@ public class GLBufferStateTracker {
if (DEBUG) {
System.err.println();
System.err.println("GLBufferStateTracker.clearBufferObjectState()");
- Thread.dumpStack();
+ //Thread.dumpStack();
}
}
}
diff --git a/src/jogl/classes/jogamp/opengl/util/glsl/fixedfunc/FixedFuncHook.java b/src/jogl/classes/jogamp/opengl/util/glsl/fixedfunc/FixedFuncHook.java
index 854d01fa6..984439031 100644
--- a/src/jogl/classes/jogamp/opengl/util/glsl/fixedfunc/FixedFuncHook.java
+++ b/src/jogl/classes/jogamp/opengl/util/glsl/fixedfunc/FixedFuncHook.java
@@ -214,7 +214,7 @@ public class FixedFuncHook implements GLLightingFunc, GLMatrixFunc, GLPointerFun
}
public void glVertexPointer(int size, int type, int stride, java.nio.Buffer pointer) {
- glVertexPointer(GLArrayDataWrapper.createFixed(GL_VERTEX_ARRAY, size, type, false, stride, pointer, -1, -1, -1));
+ glVertexPointer(GLArrayDataWrapper.createFixed(GL_VERTEX_ARRAY, size, type, false, stride, pointer, 0, 0, 0));
}
public void glVertexPointer(int size, int type, int stride, long pointer_buffer_offset) {
int vboName = gl.glGetBoundBuffer(GL.GL_ARRAY_BUFFER);
@@ -242,7 +242,7 @@ public class FixedFuncHook implements GLLightingFunc, GLMatrixFunc, GLPointerFun
}
public void glColorPointer(int size, int type, int stride, java.nio.Buffer pointer) {
glColorPointer(GLArrayDataWrapper.createFixed(GL_COLOR_ARRAY, size, type, false, stride,
- pointer, -1, -1, -1));
+ pointer, 0, 0, 0));
}
public void glColorPointer(int size, int type, int stride, long pointer_buffer_offset) {
int vboName = gl.glGetBoundBuffer(GL.GL_ARRAY_BUFFER);
@@ -273,7 +273,7 @@ public class FixedFuncHook implements GLLightingFunc, GLMatrixFunc, GLPointerFun
}
public void glNormalPointer(int type, int stride, java.nio.Buffer pointer) {
glNormalPointer(GLArrayDataWrapper.createFixed(GL_NORMAL_ARRAY, 3, type, false, stride,
- pointer, -1, -1, -1));
+ pointer, 0, 0, 0));
}
public void glNormalPointer(int type, int stride, long pointer_buffer_offset) {
int vboName = gl.glGetBoundBuffer(GL.GL_ARRAY_BUFFER);
@@ -301,7 +301,7 @@ public class FixedFuncHook implements GLLightingFunc, GLMatrixFunc, GLPointerFun
}
public void glTexCoordPointer(int size, int type, int stride, java.nio.Buffer pointer) {
glTexCoordPointer(
- GLArrayDataWrapper.createFixed(GL_TEXTURE_COORD_ARRAY, size, type, false, stride, pointer, -1, -1, -1));
+ GLArrayDataWrapper.createFixed(GL_TEXTURE_COORD_ARRAY, size, type, false, stride, pointer, 0, 0, 0));
}
public void glTexCoordPointer(int size, int type, int stride, long pointer_buffer_offset) {
int vboName = gl.glGetBoundBuffer(GL.GL_ARRAY_BUFFER);
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/RedSquare0.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/RedSquare0.java
index 3e08f0e82..d38a60ea6 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/RedSquare0.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/RedSquare0.java
@@ -78,7 +78,7 @@ public class RedSquare0 implements GLEventListener {
Assert.assertTrue(0 <= mgl_Vertex);
Assert.assertEquals(GL.GL_NO_ERROR, gl.glGetError());
FloatBuffer buffer = Buffers.newDirectFloatBuffer(numElements * components);
- GLArrayDataWrapper vertices = GLArrayDataWrapper.createGLSL("mgl_Vertex", 3, gl.GL_FLOAT, false, 0, buffer, -1, 0, -1);
+ GLArrayDataWrapper vertices = GLArrayDataWrapper.createGLSL("mgl_Vertex", 3, gl.GL_FLOAT, false, 0, buffer, 0, 0, 0);
{
// Fill them up
FloatBuffer verticeb = (FloatBuffer) vertices.getBuffer();
@@ -107,7 +107,7 @@ public class RedSquare0 implements GLEventListener {
Assert.assertTrue(0 <= mgl_Color);
Assert.assertEquals(GL.GL_NO_ERROR, gl.glGetError());
buffer = Buffers.newDirectFloatBuffer(numElements * components);
- GLArrayDataWrapper colors = GLArrayDataWrapper.createGLSL("mgl_Color", 4, gl.GL_FLOAT, false, 0, buffer, -1, 0, -1);
+ GLArrayDataWrapper colors = GLArrayDataWrapper.createGLSL("mgl_Color", 4, gl.GL_FLOAT, false, 0, buffer, 0, 0, 0);
{
// Fill them up
FloatBuffer colorb = (FloatBuffer) colors.getBuffer();