summaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/javax/media/opengl
diff options
context:
space:
mode:
Diffstat (limited to 'src/jogl/classes/javax/media/opengl')
-rw-r--r--src/jogl/classes/javax/media/opengl/awt/GLCanvas.java37
-rw-r--r--src/jogl/classes/javax/media/opengl/awt/GLJPanel.java31
2 files changed, 39 insertions, 29 deletions
diff --git a/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java b/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java
index a8aa7382d..4b1d4a7ff 100644
--- a/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java
+++ b/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java
@@ -860,32 +860,35 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing
printAnimator.remove(GLCanvas.this);
}
printGLAD = GLCanvas.this; // _not_ default, shall be replaced by offscreen GLAD
- final GLCapabilities caps = (GLCapabilities)getChosenGLCapabilities().cloneMutable();
- final int printNumSamples = printAWTTiles.getNumSamples(caps);
+ final GLCapabilitiesImmutable gladCaps = getChosenGLCapabilities();
+ final int printNumSamples = printAWTTiles.getNumSamples(gladCaps);
GLDrawable printDrawable = printGLAD.getDelegatedDrawable();
- final boolean reqNewGLADSamples = printNumSamples != caps.getNumSamples();
+ final boolean reqNewGLADSamples = printNumSamples != gladCaps.getNumSamples();
final boolean reqNewGLADSize = printAWTTiles.customTileWidth != -1 && printAWTTiles.customTileWidth != printDrawable.getSurfaceWidth() ||
printAWTTiles.customTileHeight != -1 && printAWTTiles.customTileHeight != printDrawable.getSurfaceHeight();
- final boolean reqNewGLADOnscrn = caps.isOnscreen();
- // It is desired to use a new offscreen GLAD, however Bug 830 forbids this for AA onscreen context.
- // Bug 830: swapGLContextAndAllGLEventListener and onscreen MSAA w/ NV/GLX
- final boolean reqNewGLAD = !caps.getSampleBuffers() && ( reqNewGLADOnscrn || reqNewGLADSamples || reqNewGLADSize );
+ final boolean reqNewGLADOnscrn = gladCaps.isOnscreen();
+
+ final GLCapabilities newGLADCaps = (GLCapabilities)gladCaps.cloneMutable();
+ newGLADCaps.setDoubleBuffered(false);
+ newGLADCaps.setOnscreen(false);
+ if( printNumSamples != newGLADCaps.getNumSamples() ) {
+ newGLADCaps.setSampleBuffers(0 < printNumSamples);
+ newGLADCaps.setNumSamples(printNumSamples);
+ }
+ final boolean reqNewGLADSafe = GLDrawableUtil.isSwapGLContextSafe(gladCaps, newGLADCaps);
+
+ final boolean reqNewGLAD = ( reqNewGLADOnscrn || reqNewGLADSamples || reqNewGLADSize ) && reqNewGLADSafe;
+
if( DEBUG ) {
- System.err.println("AWT print.setup: reqNewGLAD "+reqNewGLAD+"[ onscreen "+reqNewGLADOnscrn+", samples "+reqNewGLADSamples+", size "+reqNewGLADSize+"], "+
+ System.err.println("AWT print.setup: reqNewGLAD "+reqNewGLAD+"[ onscreen "+reqNewGLADOnscrn+", samples "+reqNewGLADSamples+", size "+reqNewGLADSize+", safe "+reqNewGLADSafe+"], "+
", drawableSize "+printDrawable.getSurfaceWidth()+"x"+printDrawable.getSurfaceHeight()+
", customTileSize "+printAWTTiles.customTileWidth+"x"+printAWTTiles.customTileHeight+
", scaleMat "+printAWTTiles.scaleMatX+" x "+printAWTTiles.scaleMatY+
", numSamples "+printAWTTiles.customNumSamples+" -> "+printNumSamples+", printAnimator "+printAnimator);
}
if( reqNewGLAD ) {
- caps.setDoubleBuffered(false);
- caps.setOnscreen(false);
- if( printNumSamples != caps.getNumSamples() ) {
- caps.setSampleBuffers(0 < printNumSamples);
- caps.setNumSamples(printNumSamples);
- }
- final GLDrawableFactory factory = GLDrawableFactory.getFactory(caps.getGLProfile());
- printGLAD = factory.createOffscreenAutoDrawable(null, caps, null,
+ final GLDrawableFactory factory = GLDrawableFactory.getFactory(newGLADCaps.getGLProfile());
+ printGLAD = factory.createOffscreenAutoDrawable(null, newGLADCaps, null,
printAWTTiles.customTileWidth != -1 ? printAWTTiles.customTileWidth : DEFAULT_PRINT_TILE_SIZE,
printAWTTiles.customTileHeight != -1 ? printAWTTiles.customTileHeight : DEFAULT_PRINT_TILE_SIZE);
GLDrawableUtil.swapGLContextAndAllGLEventListener(GLCanvas.this, printGLAD);
@@ -896,7 +899,7 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing
printAWTTiles.renderer.attachAutoDrawable(printGLAD);
if( DEBUG ) {
System.err.println("AWT print.setup "+printAWTTiles);
- System.err.println("AWT print.setup AA "+printNumSamples+", "+caps);
+ System.err.println("AWT print.setup AA "+printNumSamples+", "+newGLADCaps);
System.err.println("AWT print.setup printGLAD: "+printGLAD.getSurfaceWidth()+"x"+printGLAD.getSurfaceHeight()+", "+printGLAD);
System.err.println("AWT print.setup printDraw: "+printDrawable.getSurfaceWidth()+"x"+printDrawable.getSurfaceHeight()+", "+printDrawable);
}
diff --git a/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java b/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java
index 3a1e45440..96f9e455c 100644
--- a/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java
+++ b/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java
@@ -712,27 +712,34 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing
}
printGLAD = GLJPanel.this; // default: re-use
- final GLCapabilities caps = (GLCapabilities)getChosenGLCapabilities().cloneMutable();
- final int printNumSamples = printAWTTiles.getNumSamples(caps);
+ final GLCapabilitiesImmutable gladCaps = getChosenGLCapabilities();
+ final int printNumSamples = printAWTTiles.getNumSamples(gladCaps);
GLDrawable printDrawable = printGLAD.getDelegatedDrawable();
- final boolean reqNewGLADSamples = printNumSamples != caps.getNumSamples();
+ final boolean reqNewGLADSamples = printNumSamples != gladCaps.getNumSamples();
final boolean reqNewGLADSize = printAWTTiles.customTileWidth != -1 && printAWTTiles.customTileWidth != printDrawable.getSurfaceWidth() ||
printAWTTiles.customTileHeight != -1 && printAWTTiles.customTileHeight != printDrawable.getSurfaceHeight();
- final boolean reqNewGLAD = reqNewGLADSamples || reqNewGLADSize ;
+
+ final GLCapabilities newGLADCaps = (GLCapabilities)gladCaps.cloneMutable();
+ newGLADCaps.setDoubleBuffered(false);
+ newGLADCaps.setOnscreen(false);
+ if( printNumSamples != newGLADCaps.getNumSamples() ) {
+ newGLADCaps.setSampleBuffers(0 < printNumSamples);
+ newGLADCaps.setNumSamples(printNumSamples);
+ }
+ final boolean reqNewGLADSafe = GLDrawableUtil.isSwapGLContextSafe(gladCaps, newGLADCaps);
+
+ final boolean reqNewGLAD = ( reqNewGLADSamples || reqNewGLADSize ) && reqNewGLADSafe;
+
if( DEBUG ) {
- System.err.println("AWT print.setup: reqNewGLAD "+reqNewGLAD+"[ samples "+reqNewGLADSamples+", size "+reqNewGLADSize+"], "+
+ System.err.println("AWT print.setup: reqNewGLAD "+reqNewGLAD+"[ samples "+reqNewGLADSamples+", size "+reqNewGLADSize+", safe "+reqNewGLADSafe+"], "+
", drawableSize "+printDrawable.getSurfaceWidth()+"x"+printDrawable.getSurfaceHeight()+
", customTileSize "+printAWTTiles.customTileWidth+"x"+printAWTTiles.customTileHeight+
", scaleMat "+printAWTTiles.scaleMatX+" x "+printAWTTiles.scaleMatY+
", numSamples "+printAWTTiles.customNumSamples+" -> "+printNumSamples+", printAnimator "+printAnimator);
}
if( reqNewGLAD ) {
- caps.setDoubleBuffered(false);
- caps.setOnscreen(false);
- caps.setSampleBuffers(0 < printNumSamples);
- caps.setNumSamples(printNumSamples);
- final GLDrawableFactory factory = GLDrawableFactory.getFactory(caps.getGLProfile());
- printGLAD = factory.createOffscreenAutoDrawable(null, caps, null,
+ final GLDrawableFactory factory = GLDrawableFactory.getFactory(newGLADCaps.getGLProfile());
+ printGLAD = factory.createOffscreenAutoDrawable(null, newGLADCaps, null,
printAWTTiles.customTileWidth != -1 ? printAWTTiles.customTileWidth : DEFAULT_PRINT_TILE_SIZE,
printAWTTiles.customTileHeight != -1 ? printAWTTiles.customTileHeight : DEFAULT_PRINT_TILE_SIZE);
GLDrawableUtil.swapGLContextAndAllGLEventListener(GLJPanel.this, printGLAD);
@@ -743,7 +750,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing
printAWTTiles.renderer.attachAutoDrawable(printGLAD);
if( DEBUG ) {
System.err.println("AWT print.setup "+printAWTTiles);
- System.err.println("AWT print.setup AA "+printNumSamples+", "+caps);
+ System.err.println("AWT print.setup AA "+printNumSamples+", "+newGLADCaps);
System.err.println("AWT print.setup printGLAD: "+printGLAD.getSurfaceWidth()+"x"+printGLAD.getSurfaceHeight()+", "+printGLAD);
System.err.println("AWT print.setup printDraw: "+printDrawable.getSurfaceWidth()+"x"+printDrawable.getSurfaceHeight()+", "+printDrawable);
}