aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2013-05-17 08:48:57 +0200
committerSven Gothel <[email protected]>2013-05-17 08:48:57 +0200
commit9fbcc16eb37b35f4f0f02e74be6ab14169e3bad0 (patch)
tree50547831d7f10b8ba8eec43af615ddd344ac5a16
parent1cc44101bd4f44407929c686d3c6e00d36793495 (diff)
GLPixelBuffer.dispose(): Set diposed:=true to allow isValid() to work properly; GLJPanel: Rely on GLPixelBuffer.requiresNewBuffer(..) for each frame, don't use local pixelBufferCheckSize (buggy w/ singleton)
-rwxr-xr-xmake/scripts/tests.sh8
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/GLPixelBuffer.java11
-rw-r--r--src/jogl/classes/javax/media/opengl/awt/GLJPanel.java13
3 files changed, 13 insertions, 19 deletions
diff --git a/make/scripts/tests.sh b/make/scripts/tests.sh
index 3f51411f2..053e232ae 100755
--- a/make/scripts/tests.sh
+++ b/make/scripts/tests.sh
@@ -88,7 +88,7 @@ function jrun() {
#D_ARGS="-Djogl.debug.FBObject -Djogl.debug.TraceGL -Djogl.debug.GLBufferStateTracker"
#D_ARGS="-Djogl.debug.FBObject"
#D_ARGS="-Djogl.debug.GLSLCode"
- D_ARGS="-Djogl.debug.GLSLCode"
+ #D_ARGS="-Djogl.debug.GLSLCode"
#D_ARGS="-Djogl.debug.GLSLCode -Djogl.debug.DebugGL -Djogl.debug.TraceGL"
#D_ARGS="-Djogl.debug.GLContext -Dnativewindow.debug.JAWT -Dnewt.debug.Window"
#D_ARGS="-Dnativewindow.debug.JAWT -Djogamp.debug.TaskBase.TraceSource"
@@ -184,7 +184,7 @@ function jrun() {
#D_ARGS="-Dnewt.debug.Window"
#D_ARGS="-Xprof"
#D_ARGS="-Dnativewindow.debug=all"
- #D_ARGS="-Djogl.debug.GLCanvas -Djogl.debug.Java2D -Djogl.debug.GLJPanel"
+ D_ARGS="-Djogl.debug.GLCanvas -Djogl.debug.Java2D -Djogl.debug.GLJPanel"
#D_ARGS="-Djogl.debug.GLCanvas -Djogl.debug.Java2D -Djogl.debug.GLJPanel -Djogl.gljpanel.noglsl"
#D_ARGS="-Djogl.debug.GLCanvas -Djogl.debug.Animator"
#D_ARGS="-Djogl.debug.GLContext -Dnativewindow.debug.X11Util.XSync"
@@ -283,7 +283,7 @@ function testawtswt() {
#testnoawt com.jogamp.opengl.test.junit.jogl.demos.es1.newt.TestRedSquareES1NEWT $*
#testawt com.jogamp.opengl.test.junit.jogl.demos.es2.awt.TestGearsES2AWT $*
#testawt com.jogamp.opengl.test.junit.jogl.demos.es2.awt.TestGearsES2GLJPanelAWT $*
-#testawt com.jogamp.opengl.test.junit.jogl.demos.es2.awt.TestGearsES2GLJPanelsAWT $*
+testawt com.jogamp.opengl.test.junit.jogl.demos.es2.awt.TestGearsES2GLJPanelsAWT $*
#testawt com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestGearsES2NewtCanvasAWT $*
#testnoawt com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestGearsES2NEWT $*
#testawtswt com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestGearsES2NewtCanvasSWT $*
@@ -548,7 +548,7 @@ function testawtswt() {
#
# Graph
#
-testnoawt com.jogamp.opengl.test.junit.graph.TestTextRendererNEWT10 $*
+#testnoawt com.jogamp.opengl.test.junit.graph.TestTextRendererNEWT10 $*
#testnoawt com.jogamp.opengl.test.junit.graph.TestTextRendererNEWT00 $*
#testnoawt com.jogamp.opengl.test.junit.graph.TestRegionRendererNEWT01 $*
#testnoawt com.jogamp.opengl.test.junit.graph.TestTextRendererNEWT01 $*
diff --git a/src/jogl/classes/com/jogamp/opengl/util/GLPixelBuffer.java b/src/jogl/classes/com/jogamp/opengl/util/GLPixelBuffer.java
index 6b9d3bf2c..b0fc7f332 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/GLPixelBuffer.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/GLPixelBuffer.java
@@ -212,7 +212,7 @@ public class GLPixelBuffer {
this.bufferElemSize = Buffers.sizeOfBufferElem(buffer);
}
- /** Is not {@link #dispose()} and has {@link #byteSize} &gt; 0. */
+ /** Is not {@link #dispose() disposed} and has {@link #byteSize} &gt; 0. */
public boolean isValid() {
return !disposed && 0 < byteSize;
}
@@ -240,8 +240,8 @@ public class GLPixelBuffer {
}
/**
- * Returns true, if implementation requires a new buffer based on the new size
- * due to pixel alignment or byte size or if {@link #isValid() invalid}, otherwise false.
+ * Returns true, if {@link #isValid() invalid} or implementation requires a new buffer based on the new size
+ * due to pixel alignment or byte size, otherwise false.
* <p>
* It is assumed that <code>pixelAttributes</code>, <code>depth</code> and <code>pack</code> stays the same!
* </p>
@@ -257,11 +257,12 @@ public class GLPixelBuffer {
* @see GLPixelBufferProvider#allocate(GL, GLPixelAttributes, int, int, int, boolean, int)
*/
public boolean requiresNewBuffer(GL gl, int newWidth, int newHeight, int minByteSize) {
- return !isValid() || this.byteSize < minByteSize;
+ return !isValid() || byteSize < minByteSize;
}
- /** Dispose resources. */
+ /** Dispose resources. See {@link #isValid()}. */
public void dispose() {
+ disposed = true;
buffer.clear();
}
}
diff --git a/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java b/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java
index 7359e1b47..b11f359be 100644
--- a/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java
+++ b/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java
@@ -978,7 +978,6 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing
private final AWTGLPixelBufferProvider pixelBufferProvider;
private final boolean useSingletonBuffer;
private AWTGLPixelBuffer pixelBuffer;
- private boolean pixelBufferCheckSize;
// One of these is used to store the read back pixels before storing
// in the BufferedImage
@@ -1160,14 +1159,10 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing
if( useSingletonBuffer ) { // attempt to fetch the latest AWTGLPixelBuffer
pixelBuffer = (AWTGLPixelBuffer) ((SingletonGLPixelBufferProvider)pixelBufferProvider).getSingleBuffer(pixelAttribs);
}
- if( pixelBufferCheckSize ) {
- pixelBufferCheckSize = false;
- if( null != pixelBuffer && pixelBuffer.requiresNewBuffer(gl, panelWidth, panelHeight, 0) ) {
- pixelBuffer.dispose();
- pixelBuffer = null;
- }
+ if( null != pixelBuffer && pixelBuffer.requiresNewBuffer(gl, panelWidth, panelHeight, 0) ) {
+ pixelBuffer.dispose();
+ pixelBuffer = null;
}
-
if ( null == pixelBuffer ) {
if (0 >= panelWidth || 0 >= panelHeight ) {
return;
@@ -1300,8 +1295,6 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing
}
}
}
-
- pixelBufferCheckSize = true;
return _drawable.isRealized();
}