aboutsummaryrefslogtreecommitdiffstats
path: root/src/jogl
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2013-12-10 21:27:14 +0100
committerSven Gothel <[email protected]>2013-12-10 21:27:14 +0100
commitf8c2a90129736844a12b76d658cb339a7c36cd9a (patch)
tree991566f6e9fc4006f1d031aeac916db0e3d58224 /src/jogl
parent990b25adf6e0b6ab5c79d8ca43bc327fb93a755e (diff)
Bug 904: 'User Vertical Flip' for GLJPanel w/o vertical flip must be considered in AWTTilePainter: 'Origin of GL image is still on Bottom'
Diffstat (limited to 'src/jogl')
-rw-r--r--src/jogl/classes/javax/media/opengl/awt/GLCanvas.java2
-rw-r--r--src/jogl/classes/javax/media/opengl/awt/GLJPanel.java2
-rw-r--r--src/jogl/classes/jogamp/opengl/awt/AWTTilePainter.java21
3 files changed, 18 insertions, 7 deletions
diff --git a/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java b/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java
index 36c0144a9..0bc002f8e 100644
--- a/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java
+++ b/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java
@@ -858,7 +858,7 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing
GLDrawableUtil.swapGLContextAndAllGLEventListener(GLCanvas.this, printGLAD);
printDrawable = printGLAD.getDelegatedDrawable();
}
- printAWTTiles.setIsGLOriented(printGLAD.isGLOriented());
+ printAWTTiles.setGLOrientation(printGLAD.isGLOriented(), printGLAD.isGLOriented());
printAWTTiles.renderer.setTileSize(printDrawable.getWidth(), printDrawable.getHeight(), 0);
printAWTTiles.renderer.attachAutoDrawable(printGLAD);
if( DEBUG ) {
diff --git a/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java b/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java
index 8670c3746..a71b47c64 100644
--- a/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java
+++ b/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java
@@ -649,7 +649,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing
GLDrawableUtil.swapGLContextAndAllGLEventListener(GLJPanel.this, printGLAD);
printDrawable = printGLAD.getDelegatedDrawable();
}
- printAWTTiles.setIsGLOriented( !GLJPanel.this.skipGLOrientationVerticalFlip && printGLAD.isGLOriented() );
+ printAWTTiles.setGLOrientation( !GLJPanel.this.skipGLOrientationVerticalFlip && printGLAD.isGLOriented(), printGLAD.isGLOriented() );
printAWTTiles.renderer.setTileSize(printDrawable.getWidth(), printDrawable.getHeight(), 0);
printAWTTiles.renderer.attachAutoDrawable(printGLAD);
if( DEBUG ) {
diff --git a/src/jogl/classes/jogamp/opengl/awt/AWTTilePainter.java b/src/jogl/classes/jogamp/opengl/awt/AWTTilePainter.java
index ff07b04d0..1c1d2350a 100644
--- a/src/jogl/classes/jogamp/opengl/awt/AWTTilePainter.java
+++ b/src/jogl/classes/jogamp/opengl/awt/AWTTilePainter.java
@@ -74,7 +74,10 @@ public class AWTTilePainter {
public final int customTileWidth, customTileHeight, customNumSamples;
public final boolean verbose;
+ /** Default for OpenGL: True */
public boolean flipVertical;
+ /** Default for OpenGL: True */
+ public boolean originBottomLeft;
private AWTGLPixelBuffer tBuffer = null;
private BufferedImage vFlipImage = null;
private Graphics2D g2d = null;
@@ -148,10 +151,18 @@ public class AWTTilePainter {
}
@Override
- public String toString() { return renderer.toString(); }
+ public String toString() {
+ return "AWTTilePainter[flipVertical "+flipVertical+", startFromBottom "+originBottomLeft+", "+
+ renderer.toString()+"]";
+ }
- public void setIsGLOriented(boolean v) {
- flipVertical = v;
+ /**
+ * @param flipVertical if <code>true</code>, the image will be flipped vertically (Default for OpenGL).
+ * @param originBottomLeft if <code>true</code>, the image's origin is on the bottom left (Default for OpenGL).
+ */
+ public void setGLOrientation(boolean flipVertical, boolean originBottomLeft) {
+ this.flipVertical = flipVertical;
+ this.originBottomLeft = originBottomLeft;
}
private static Rectangle2D getClipBounds2D(Graphics2D g) {
@@ -307,7 +318,7 @@ public class AWTTilePainter {
final int tHeight = renderer.getParam(TileRendererBase.TR_CURRENT_TILE_HEIGHT);
final int tY = renderer.getParam(TileRendererBase.TR_CURRENT_TILE_Y_POS);
final int tYOff = renderer.getParam(TileRenderer.TR_TILE_Y_OFFSET);
- final int imgYOff = flipVertical ? 0 : renderer.getParam(TileRenderer.TR_TILE_HEIGHT) - tHeight; // imgYOff will be cut-off via sub-image
+ final int imgYOff = originBottomLeft ? 0 : renderer.getParam(TileRenderer.TR_TILE_HEIGHT) - tHeight; // imgYOff will be cut-off via sub-image
final int pX = renderer.getParam(TileRendererBase.TR_CURRENT_TILE_X_POS); // tileX == pX
final int pY = cis.getHeight() - ( tY - tYOff + tHeight ) + scaledYOffset;
@@ -380,7 +391,7 @@ public class AWTTilePainter {
System.err.println("XXX tile-post.X "+renderer);
System.err.println("XXX tile-post.X dst-img "+dstImage.getWidth()+"x"+dstImage.getHeight());
System.err.println("XXX tile-post.X out-img "+outImage.getWidth()+"x"+outImage.getHeight());
- System.err.println("XXX tile-post.X y-flip "+flipVertical+" -> "+pX+"/"+pY+", drawDone "+drawDone);
+ System.err.println("XXX tile-post.X y-flip "+flipVertical+", originBottomLeft "+originBottomLeft+" -> "+pX+"/"+pY+", drawDone "+drawDone);
}
}
@Override