aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2013-09-21 05:19:32 +0200
committerSven Gothel <[email protected]>2013-09-21 05:19:32 +0200
commit4ef07dc20a3d867feb1c51b4ce22ae3d06094781 (patch)
tree4888a9933d855f47fcc40af7d8dcbc96d9abd4e0
parent939d6304d464e69b1d1d2a104c3da5536d3bf326 (diff)
Fix Bug 839: Clarify whether resetStates(..) shall clearStates() - Pass 'isInit' flag.
-rw-r--r--make/scripts/tests.sh6
-rw-r--r--src/jogl/classes/javax/media/opengl/GLContext.java9
-rw-r--r--src/jogl/classes/jogamp/opengl/GLContextImpl.java39
-rw-r--r--src/jogl/classes/jogamp/opengl/GLStateTracker.java1
-rw-r--r--src/jogl/classes/jogamp/opengl/egl/EGLContext.java4
-rw-r--r--src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java4
-rw-r--r--src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLContext.java4
-rw-r--r--src/jogl/classes/jogamp/opengl/x11/glx/X11GLXContext.java4
8 files changed, 37 insertions, 34 deletions
diff --git a/make/scripts/tests.sh b/make/scripts/tests.sh
index 7c2d90075..4702e98ef 100644
--- a/make/scripts/tests.sh
+++ b/make/scripts/tests.sh
@@ -217,7 +217,7 @@ function jrun() {
#D_ARGS="-Djogl.debug.GLContext -Dnewt.debug=all"
#D_ARGS="-Dnewt.debug=all"
#D_ARGS="-Djogl.debug.GLCanvas -Djogl.debug.GLJPanel -Djogl.debug.TileRenderer -Djogl.debug.TileRenderer.PNG"
- D_ARGS="-Djogl.debug.GLCanvas -Djogl.debug.GLJPanel -Djogl.debug.TileRenderer"
+ #D_ARGS="-Djogl.debug.GLCanvas -Djogl.debug.GLJPanel -Djogl.debug.TileRenderer"
#D_ARGS="-Djogl.debug.PNGImage"
#D_ARGS="-Djogl.debug.JPEGImage"
#D_ARGS="-Djogl.debug.GLDrawable -Dnativewindow.debug.GraphicsConfiguration -Djogl.debug.CapabilitiesChooser"
@@ -303,7 +303,7 @@ function testawtswt() {
#testnoawt com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestLandscapeES2NEWT $*
#testawtswt com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestGearsES2NewtCanvasSWT $*
#testnoawt com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestElektronenMultipliziererNEWT $*
-#testnoawt com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestGearsES2NEWT $*
+testnoawt com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestGearsES2NEWT $*
#testnoawt com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestRedSquareES2NEWT $*
#testswt com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestGearsES2NewtCanvasSWT $*
#testswt com.jogamp.opengl.test.junit.jogl.demos.es2.swt.TestGearsES2SWT $*
@@ -332,7 +332,7 @@ function testawtswt() {
#testawt com.jogamp.opengl.test.junit.jogl.tile.TestRandomTiledRendering3GL2AWT $*
#testawt com.jogamp.opengl.test.junit.jogl.tile.TestTiledPrintingGearsAWT $*
#testawt com.jogamp.opengl.test.junit.jogl.tile.TestTiledPrintingGearsSwingAWT $*
-testawt com.jogamp.opengl.test.junit.jogl.tile.TestTiledPrintingGearsSwingAWT2 $*
+#testawt com.jogamp.opengl.test.junit.jogl.tile.TestTiledPrintingGearsSwingAWT2 $*
#testawt com.jogamp.opengl.test.junit.jogl.tile.TestTiledPrintingGearsNewtAWT $*
#testawt com.jogamp.opengl.test.junit.jogl.tile.TestTiledPrintingNIOImageSwingAWT $*
diff --git a/src/jogl/classes/javax/media/opengl/GLContext.java b/src/jogl/classes/javax/media/opengl/GLContext.java
index 854d96807..2dca2a685 100644
--- a/src/jogl/classes/javax/media/opengl/GLContext.java
+++ b/src/jogl/classes/javax/media/opengl/GLContext.java
@@ -208,7 +208,7 @@ public abstract class GLContext {
protected long contextHandle;
protected GLContext() {
- resetStates();
+ resetStates(true);
}
protected VersionNumber ctxVersion;
@@ -222,9 +222,12 @@ public abstract class GLContext {
/** Did the drawable association changed ? see {@link GLRendererQuirks#NoSetSwapIntervalPostRetarget} */
protected boolean drawableRetargeted;
- protected void resetStates() {
+ /**
+ * @param isInit true if called for class initialization, otherwise false (re-init or destruction).
+ */
+ protected void resetStates(boolean isInit) {
if (DEBUG) {
- System.err.println(getThreadName() + ": GLContext.resetStates()");
+ System.err.println(getThreadName() + ": GLContext.resetStates(isInit "+isInit+")");
// Thread.dumpStack();
}
ctxVersion = VersionNumberString.zeroVersion;
diff --git a/src/jogl/classes/jogamp/opengl/GLContextImpl.java b/src/jogl/classes/jogamp/opengl/GLContextImpl.java
index ff90966cd..77cbd0ed9 100644
--- a/src/jogl/classes/jogamp/opengl/GLContextImpl.java
+++ b/src/jogl/classes/jogamp/opengl/GLContextImpl.java
@@ -157,19 +157,16 @@ public abstract class GLContextImpl extends GLContext {
if (bufferSizeTracker != null) {
bufferSizeTracker.clearCachedBufferSizes();
}
- if (bufferStateTracker != null) { // <init>
- bufferStateTracker.clearBufferObjectState();
- }
- if (glStateTracker != null) { // <init>
- glStateTracker.setEnabled(false);
- glStateTracker.clearStates();
- }
+ bufferStateTracker.clearBufferObjectState();
+ glStateTracker.setEnabled(false);
+ glStateTracker.clearStates();
}
@Override
- protected void resetStates() {
- clearStates();
-
+ protected void resetStates(boolean isInit) {
+ if( !isInit ) {
+ clearStates();
+ }
extensionAvailability = null;
glProcAddressTable = null;
gl = null;
@@ -188,7 +185,7 @@ public abstract class GLContextImpl extends GLContext {
pixelDataEvaluated = false;
- super.resetStates();
+ super.resetStates(isInit);
}
@Override
@@ -435,6 +432,7 @@ public abstract class GLContextImpl extends GLContext {
if(GLContextShareSet.contextDestroyed(this) && !GLContextShareSet.hasCreatedSharedLeft(this)) {
GLContextShareSet.unregisterSharing(this);
}
+ resetStates(false);
} finally {
lock.unlock();
if ( DEBUG_TRACE_SWITCH ) {
@@ -448,8 +446,9 @@ public abstract class GLContextImpl extends GLContext {
if( null != associateDrawableException ) {
throw new GLException("Exception @ destroy's associateDrawable(false)", associateDrawableException);
}
+ } else {
+ resetStates(false);
}
- resetStates();
}
protected abstract void destroyImpl() throws GLException;
@@ -629,7 +628,7 @@ public abstract class GLContextImpl extends GLContext {
*/
}
if( TRACE_SWITCH ) {
- System.err.println(getThreadName() +": GLContext.ContextSwitch[makeCurrent.X3]: obj " + toHexString(hashCode()) + ", ctx "+toHexString(contextHandle)+", surf "+toHexString(drawable.getHandle())+" - switch - "+makeCurrentResultToString(res)+" - "+lock);
+ System.err.println(getThreadName() +": GLContext.ContextSwitch[makeCurrent.X3]: obj " + toHexString(hashCode()) + ", ctx "+toHexString(contextHandle)+", surf "+toHexString(drawable.getHandle())+" - switch - "+makeCurrentResultToString(res)+" - stateTracker.on "+glStateTracker.isEnabled()+" - "+lock);
}
return res;
}
@@ -868,14 +867,14 @@ public abstract class GLContextImpl extends GLContext {
if(PROFILE_ALIASING) {
hasGL3 = true;
}
- resetStates(); // clean context states, since creation was temporary
+ resetStates(false); // clean context states, since creation was temporary
}
}
if(!hasGL3) {
hasGL3 = createContextARBMapVersionsAvailable(3, CTX_PROFILE_CORE); // GL3
success |= hasGL3;
if(hasGL3) {
- resetStates(); // clean this context states, since creation was temporary
+ resetStates(false); // clean this context states, since creation was temporary
}
}
if(!hasGL4bc) {
@@ -897,7 +896,7 @@ public abstract class GLContextImpl extends GLContext {
hasGL4 = true;
hasGL3 = true;
}
- resetStates(); // clean this context states, since creation was temporary
+ resetStates(false); // clean this context states, since creation was temporary
}
}
if(!hasGL3bc) {
@@ -913,21 +912,21 @@ public abstract class GLContextImpl extends GLContext {
hasGL2 = true;
hasGL3 = true;
}
- resetStates(); // clean this context states, since creation was temporary
+ resetStates(false); // clean this context states, since creation was temporary
}
}
if(!hasGL2) {
hasGL2 = createContextARBMapVersionsAvailable(2, CTX_PROFILE_COMPAT); // GL2
success |= hasGL2;
if(hasGL2) {
- resetStates(); // clean this context states, since creation was temporary
+ resetStates(false); // clean this context states, since creation was temporary
}
}
if(!hasES3) {
hasES3 = createContextARBMapVersionsAvailable(3, CTX_PROFILE_ES); // ES3
success |= hasES3;
if(hasES3) {
- resetStates(); // clean this context states, since creation was temporary
+ resetStates(false); // clean this context states, since creation was temporary
}
}
if(success) {
@@ -946,7 +945,7 @@ public abstract class GLContextImpl extends GLContext {
}
/**
- * Note: Since context creation is temporary, caller need to issue {@link #resetStates()}, if creation was successful, i.e. returns true.
+ * Note: Since context creation is temporary, caller need to issue {@link #resetStates(boolean)}, if creation was successful, i.e. returns true.
* This method does not reset the states, allowing the caller to utilize the state variables.
**/
private final boolean createContextARBMapVersionsAvailable(int reqMajor, int reqProfile) {
diff --git a/src/jogl/classes/jogamp/opengl/GLStateTracker.java b/src/jogl/classes/jogamp/opengl/GLStateTracker.java
index 69411979f..01c3716e0 100644
--- a/src/jogl/classes/jogamp/opengl/GLStateTracker.java
+++ b/src/jogl/classes/jogamp/opengl/GLStateTracker.java
@@ -42,6 +42,7 @@ package jogamp.opengl;
import javax.media.opengl.*;
import com.jogamp.common.util.IntIntHashMap;
+
import java.nio.IntBuffer;
import java.util.ArrayList;
diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLContext.java b/src/jogl/classes/jogamp/opengl/egl/EGLContext.java
index e7977e3fb..179cb7504 100644
--- a/src/jogl/classes/jogamp/opengl/egl/EGLContext.java
+++ b/src/jogl/classes/jogamp/opengl/egl/EGLContext.java
@@ -70,12 +70,12 @@ public class EGLContext extends GLContextImpl {
}
@Override
- protected void resetStates() {
+ protected void resetStates(boolean isInit) {
eglQueryStringInitialized = false;
eglQueryStringAvailable = false;
eglExtProcAddressTable = null;
// no inner state _eglExt = null;
- super.resetStates();
+ super.resetStates(isInit);
}
@Override
diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java
index 6787ef500..e6334150b 100644
--- a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java
+++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java
@@ -193,10 +193,10 @@ public class MacOSXCGLContext extends GLContextImpl
}
@Override
- protected void resetStates() {
+ protected void resetStates(boolean isInit) {
// no inner state _cglExt = null;
cglExtProcAddressTable = null;
- super.resetStates();
+ super.resetStates(isInit);
}
@Override
diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLContext.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLContext.java
index b8979c91e..3fad22d88 100644
--- a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLContext.java
+++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLContext.java
@@ -93,7 +93,7 @@ public class WindowsWGLContext extends GLContextImpl {
}
@Override
- protected void resetStates() {
+ protected void resetStates(boolean isInit) {
wglGetExtensionsStringEXTInitialized=false;
wglGetExtensionsStringEXTAvailable=false;
wglGLReadDrawableAvailableSet=false;
@@ -102,7 +102,7 @@ public class WindowsWGLContext extends GLContextImpl {
wglExtProcAddressTable=null;
hasSwapIntervalSGI = 0;
hasSwapGroupNV = 0;
- super.resetStates();
+ super.resetStates(isInit);
}
@Override
diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXContext.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXContext.java
index 4bfe0cb86..0ecf11a43 100644
--- a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXContext.java
+++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXContext.java
@@ -100,7 +100,7 @@ public class X11GLXContext extends GLContextImpl {
}
@Override
- protected void resetStates() {
+ protected void resetStates(boolean isInit) {
// no inner state _glXExt=null;
glXExtProcAddressTable = null;
hasSwapInterval = 0;
@@ -108,7 +108,7 @@ public class X11GLXContext extends GLContextImpl {
isDirect = false;
glXServerVersion = null;
isGLXVersionGreaterEqualOneThree = false;
- super.resetStates();
+ super.resetStates(isInit);
}
@Override