From 77b0adbdb6e361e4d5d6ca31432e8fc625d02b24 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Fri, 18 Oct 2013 01:21:46 +0200 Subject: AWTPrintLifecycle.setupPrint(..): Fix regression of commit a05b87a369441d9ef38f97929f866b3d4ced0e57: NULL printGLAD of GLCanvas and NewtCanvasAWT We have to pre-init printGLAD w/ current GLAD (similiar w/ GLJPanel). Also properly define reqNewGLAD: reqNewGLAD = !caps.getSampleBuffers() && ( reqNewGLADOnscrn || reqNewGLADSamples || reqNewGLADSize ); where '!caps.getSampleBuffers() && ( .. )' is due to Bug 830, swapGLContextAndAllGLEventListener and onscreen MSAA w/ NV/GLX does not work. --- src/jogl/classes/javax/media/opengl/awt/GLCanvas.java | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'src/jogl') diff --git a/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java b/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java index b9576b8d6..6828beb10 100644 --- a/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java +++ b/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java @@ -757,24 +757,25 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing if( null != printAnimator ) { 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); GLDrawable printDrawable = printGLAD.getDelegatedDrawable(); final boolean reqNewGLADSamples = printNumSamples != caps.getNumSamples(); final boolean reqNewGLADSize = printAWTTiles.customTileWidth != -1 && printAWTTiles.customTileWidth != printDrawable.getWidth() || printAWTTiles.customTileHeight != -1 && printAWTTiles.customTileHeight != printDrawable.getHeight(); - final boolean reqNewGLAD = !caps.getSampleBuffers(); // reqNewGLADSamples || reqNewGLADSize ; + 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 ); if( DEBUG ) { - System.err.println("AWT print.setup: reqNewGLAD "+reqNewGLAD+"[ samples "+reqNewGLADSamples+", size "+reqNewGLADSize+"], "+ + System.err.println("AWT print.setup: reqNewGLAD "+reqNewGLAD+"[ onscreen "+reqNewGLADOnscrn+", samples "+reqNewGLADSamples+", size "+reqNewGLADSize+"], "+ ", drawableSize "+printDrawable.getWidth()+"x"+printDrawable.getHeight()+ ", customTileSize "+printAWTTiles.customTileWidth+"x"+printAWTTiles.customTileHeight+ ", scaleMat "+printAWTTiles.scaleMatX+" x "+printAWTTiles.scaleMatY+ ", numSamples "+printAWTTiles.customNumSamples+" -> "+printNumSamples+", printAnimator "+printAnimator); } - if( caps.getSampleBuffers() ) { - // Bug 830: swapGLContextAndAllGLEventListener and onscreen MSAA w/ NV/GLX - printGLAD = GLCanvas.this; - } else { + if( reqNewGLAD ) { caps.setDoubleBuffered(false); caps.setOnscreen(false); if( printNumSamples != caps.getNumSamples() ) { -- cgit v1.2.3