diff options
author | Sven Gothel <[email protected]> | 2012-09-20 15:23:34 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2012-09-20 15:23:34 +0200 |
commit | 5684b94b1e7330b0008463bdee170358e9ecfa4c (patch) | |
tree | 06e5e7b1d284fc08414ccd5605e126754a9b1abe /src/jogl/classes/jogamp/opengl | |
parent | 3c09f42d372f89bdb41ab4cf2f96962971ad909a (diff) |
Make GLBufferStateTracker more robust: Catch GLError on Get(), causes INVALID_ENUM w/ pname GL_PIXEL_UNPACK_BUFFER_BINDING on GL 3.0 Mesa 8.0.4
Diffstat (limited to 'src/jogl/classes/jogamp/opengl')
-rw-r--r-- | src/jogl/classes/jogamp/opengl/GLBufferStateTracker.java | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/jogl/classes/jogamp/opengl/GLBufferStateTracker.java b/src/jogl/classes/jogamp/opengl/GLBufferStateTracker.java index 92e27cbd4..4a1a81bcb 100644 --- a/src/jogl/classes/jogamp/opengl/GLBufferStateTracker.java +++ b/src/jogl/classes/jogamp/opengl/GLBufferStateTracker.java @@ -100,7 +100,6 @@ public class GLBufferStateTracker { 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)); @@ -128,11 +127,16 @@ public class GLBufferStateTracker { default: gotQueryTarget = false; break; } if (gotQueryTarget) { + final int glerrPre = caller.glGetError(); // clear caller.glGetIntegerv(queryTarget, bufTmp, 0); - value = bufTmp[0]; + final int glerrPost = caller.glGetError(); // be safe, e.g. GL '3.0 Mesa 8.0.4' may produce an error querying GL_PIXEL_UNPACK_BUFFER_BINDING, ignore value + if(GL.GL_NO_ERROR == glerrPost) { + value = bufTmp[0]; + } else { + value = 0; + } if (DEBUG) { - System.err.println(); - System.err.println("GLBufferStateTracker.getBoundBufferObject() [queried value]: target 0x" + + System.err.println("GLBufferStateTracker.getBoundBufferObject() glerr[pre 0x"+Integer.toHexString(glerrPre)+", post 0x"+Integer.toHexString(glerrPost)+"], [queried value]: target 0x" + Integer.toHexString(target) + " / query 0x"+Integer.toHexString(queryTarget)+ " -> mapped bound buffer 0x" + Integer.toHexString(value)); } @@ -142,7 +146,6 @@ public class GLBufferStateTracker { return 0; } if (DEBUG) { - System.err.println(); System.err.println("GLBufferStateTracker.getBoundBufferObject() [mapped value]: target 0x" + Integer.toHexString(target) + " -> mapped bound buffer 0x" + Integer.toHexString(value)); @@ -160,7 +163,6 @@ public class GLBufferStateTracker { public final void clearBufferObjectState() { bindingMap.clear(); if (DEBUG) { - System.err.println(); System.err.println("GLBufferStateTracker.clearBufferObjectState()"); //Thread.dumpStack(); } |