aboutsummaryrefslogtreecommitdiffstats
path: root/src/jogl/classes
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2013-09-28 04:03:04 +0200
committerSven Gothel <[email protected]>2013-09-28 04:03:04 +0200
commitfe284b515d984198fdbe702837809f181625a457 (patch)
treeec20c43590c43ad185cbaca8119a66c8ba664615 /src/jogl/classes
parentc8abb9d2c9a8c92f0c5c42aba13e3e80c69739dc (diff)
AWT Printing: releasePrint() issue reshape from AWT-EDT; GLJPanel: Issue 'handleReshape' if panelSize/awtSize mismatch, otherwise 'sendReshape' and exception if offscreen size doesn't match panelSize.
Diffstat (limited to 'src/jogl/classes')
-rw-r--r--src/jogl/classes/javax/media/opengl/awt/GLCanvas.java4
-rw-r--r--src/jogl/classes/javax/media/opengl/awt/GLJPanel.java40
2 files changed, 31 insertions, 13 deletions
diff --git a/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java b/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java
index 379d9cdfe..f86a6a347 100644
--- a/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java
+++ b/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java
@@ -799,8 +799,6 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing
}
sendReshape = false; // clear reshape flag
AWTEDTExecutor.singleton.invoke(getTreeLock(), true /* allowOnNonEDT */, true /* wait */, releasePrintOnEDT);
- sendReshape = true; // trigger reshape, i.e. gl-viewport and -listener - this component might got resized!
- display();
}
private final Runnable releasePrintOnEDT = new Runnable() {
@Override
@@ -819,7 +817,9 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing
printAnimator.add(GLCanvas.this);
printAnimator = null;
}
+ sendReshape = true; // trigger reshape, i.e. gl-viewport and -listener - this component might got resized!
printActive = false;
+ display();
}
};
diff --git a/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java b/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java
index c639da367..01270dd4f 100644
--- a/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java
+++ b/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java
@@ -434,14 +434,16 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing
// involve destroying the pbuffer (current context) and
// re-creating it -- tricky to do properly while the context is
// current
- if (handleReshape) {
- handleReshape = false;
- sendReshape = handleReshape();
- }
-
- if( isVisible() && !printActive ) {
- updater.setGraphics(g);
- backend.doPaintComponent(g);
+ if( !printActive ) {
+ if (handleReshape) {
+ handleReshape = false;
+ sendReshape = handleReshape();
+ }
+
+ if( isVisible() ) {
+ updater.setGraphics(g);
+ backend.doPaintComponent(g);
+ }
}
}
@@ -578,10 +580,8 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing
sendReshape = false; // clear reshape flag
handleReshape = false; // ditto
AWTEDTExecutor.singleton.invoke(getTreeLock(), true /* allowOnNonEDT */, true /* wait */, releasePrintOnEDT);
- sendReshape = true; // trigger reshape, i.e. gl-viewport and -listener - this component might got resized!
- handleReshape = true; // ditto
- display();
}
+
private final Runnable releasePrintOnEDT = new Runnable() {
@Override
public void run() {
@@ -599,7 +599,22 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing
printAnimator.add(GLJPanel.this);
printAnimator = null;
}
+
+ // trigger reshape, i.e. gl-viewport and -listener - this component might got resized!
+ final int awtWidth = GLJPanel.this.getWidth();
+ final int awtHeight= GLJPanel.this.getHeight();
+ if( panelWidth != awtWidth || panelHeight != awtHeight ) {
+ if ( true || DEBUG ) {
+ System.err.println(getThreadName()+": GLJPanel.releasePrintOnEDT.0: reshape " +panelWidth+"x"+panelHeight + " -> " + awtWidth+"x"+awtHeight);
+ }
+ reshapeWidth = awtWidth;
+ reshapeHeight = awtHeight;
+ handleReshape = true; // complete resize, sendReshape will be set later
+ } else {
+ sendReshape = true; // only GL reshape
+ }
printActive = false;
+ display();
}
};
@@ -1415,6 +1430,9 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing
System.err.println(getThreadName()+": GLJPanel.OffscreenBackend.postGL.0: panelSize "+panelWidth+"x"+panelHeight);
}
}
+ if( offscreenDrawable.getWidth() != panelWidth || offscreenDrawable.getHeight() != panelHeight ) {
+ throw new InternalError("OffscreenDrawable panelSize mismatch (reshape missed): panelSize "+panelWidth+"x"+panelHeight+" != drawable "+offscreenDrawable.getWidth()+"x"+offscreenDrawable.getHeight()+", on thread "+getThreadName());
+ }
final IntBuffer readBackInts;
if( !flipVertical || null != glslTextureRaster ) {