From 4d33a2df1e991ab75817dcb44061d88d3c499cdb Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Mon, 1 Aug 2011 15:16:14 +0200 Subject: VBO and Texture Names: Allos (int) < 0 - unusual valid names for some GL impl. Turns out some GL impl. use VBO names like 0xa2d67443, which is (int) < 0. --- .../classes/com/jogamp/opengl/util/GLArrayDataWrapper.java | 10 ++++++---- src/jogl/classes/com/jogamp/opengl/util/ImmModeSink.java | 10 +++++----- src/jogl/classes/com/jogamp/opengl/util/texture/Texture.java | 8 ++++---- 3 files changed, 15 insertions(+), 13 deletions(-) (limited to 'src') diff --git a/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataWrapper.java b/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataWrapper.java index 735bd11f7..5f0c9b8db 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataWrapper.java +++ b/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataWrapper.java @@ -195,12 +195,14 @@ public class GLArrayDataWrapper implements GLArrayData { } /** - * Set the VBO buffer name, if valid (>0) enable use of VBO + * 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(vboName>0); + setVBOEnabled(0!=vboName); } /** @@ -272,8 +274,8 @@ public class GLArrayDataWrapper implements GLArrayData { this.stride=stride; this.strideB=(0==stride)?components*componentSize:stride; this.strideL=(0==stride)?components:strideB/componentSize; - this.vboName=vboName; - this.vboEnabled=vboName>0; + this.vboName= vboName; + this.vboEnabled= 0 != vboName ; this.vboOffset=vboOffset; switch(vboUsage) { diff --git a/src/jogl/classes/com/jogamp/opengl/util/ImmModeSink.java b/src/jogl/classes/com/jogamp/opengl/util/ImmModeSink.java index 9e92a9a1d..96f4cef92 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/ImmModeSink.java +++ b/src/jogl/classes/com/jogamp/opengl/util/ImmModeSink.java @@ -303,8 +303,8 @@ public class ImmModeSink { this.sealed=false; this.sealedGL=false; - this.mode = -1; - this.modeOrig = -1; + this.mode = 0; + this.modeOrig = 0; this.bufferEnabled=false; this.bufferWritten=false; } @@ -315,7 +315,7 @@ public class ImmModeSink { } protected void checkSeal(boolean test) throws GLException { - if(mode<0) { + if(0==mode) { throw new GLException("No mode set yet, call glBegin(mode) first:\n\t"+this); } if(sealed!=test) { @@ -642,8 +642,8 @@ public class ImmModeSink { } rewind(); - this.mode = -1; - this.modeOrig = -1; + this.mode = 0; + this.modeOrig = 0; this.sealed=false; this.bufferEnabled=false; this.bufferWritten=false; diff --git a/src/jogl/classes/com/jogamp/opengl/util/texture/Texture.java b/src/jogl/classes/com/jogamp/opengl/util/texture/Texture.java index 08f56ef27..b6df365ba 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/texture/Texture.java +++ b/src/jogl/classes/com/jogamp/opengl/util/texture/Texture.java @@ -269,7 +269,7 @@ public class Texture { * @throws GLException if any OpenGL-related errors occurred */ public void destroy(GL gl) throws GLException { - if(0= texID ) { + if( 0 == texID ) { if( null != gl ) { int[] tmp = new int[1]; gl.glGenTextures(1, tmp, 0); texID = tmp[0]; - if ( 0 >= texID && throwException ) { + if ( 0 == texID && throwException ) { throw new GLException("Create texture ID invalid: texID "+texID+", glerr 0x"+Integer.toHexString(gl.glGetError())); } } else if ( throwException ) { throw new GLException("No GL context given, can't create texture ID"); } } - return 0 < texID; + return 0 != texID; } // Helper routines for disabling certain codepaths -- cgit v1.2.3