From bab6160df764871f6fa4db040362976f028d015b Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Fri, 5 Oct 2012 18:46:16 +0200 Subject: Refine ed7d5f2e3fc696d47b10c8d62a071643bf385588, set and restore FBO caps @ setRealized(true/false) already, refine at initialize(true) Allowing to validate the on-/offscreen state after setRealized(true). Adding comment in GLFBODrawable. --- src/jogl/classes/jogamp/opengl/GLFBODrawableImpl.java | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) (limited to 'src/jogl/classes/jogamp') diff --git a/src/jogl/classes/jogamp/opengl/GLFBODrawableImpl.java b/src/jogl/classes/jogamp/opengl/GLFBODrawableImpl.java index 0a8a55ff3..f14c7e5e7 100644 --- a/src/jogl/classes/jogamp/opengl/GLFBODrawableImpl.java +++ b/src/jogl/classes/jogamp/opengl/GLFBODrawableImpl.java @@ -83,11 +83,8 @@ public class GLFBODrawableImpl extends GLDrawableImpl implements GLFBODrawable { } private final void initialize(boolean realize, GL gl) { - final MutableGraphicsConfiguration msConfig = (MutableGraphicsConfiguration) surface.getGraphicsConfiguration(); if(realize) { - origParentChosenCaps = (GLCapabilitiesImmutable) msConfig.getChosenCapabilities(); - final GLCapabilities chosenFBOCaps = (GLCapabilities) origParentChosenCaps.cloneMutable(); - chosenFBOCaps.copyFrom(getRequestedGLCapabilities()); + final GLCapabilities chosenFBOCaps = (GLCapabilities) getChosenGLCapabilities(); // cloned at setRealized(true) final int maxSamples = gl.getMaxRenderbufferSamples(); { @@ -132,7 +129,6 @@ public class GLFBODrawableImpl extends GLDrawableImpl implements GLFBODrawable { fboBound = false; fbos[0].formatToGLCapabilities(chosenFBOCaps); chosenFBOCaps.setDoubleBuffered( chosenFBOCaps.getDoubleBuffered() || samples > 0 ); - msConfig.setChosenCapabilities(chosenFBOCaps); initialized = true; } else { @@ -144,7 +140,6 @@ public class GLFBODrawableImpl extends GLDrawableImpl implements GLFBODrawable { fbos=null; fboBound = false; pendingFBOReset = -1; - msConfig.setChosenCapabilities(origParentChosenCaps); } if(DEBUG) { System.err.println("GLFBODrawableImpl.initialize("+realize+"): "+this); @@ -281,7 +276,17 @@ public class GLFBODrawableImpl extends GLDrawableImpl implements GLFBODrawable { @Override protected final void setRealizedImpl() { - parent.setRealized(realized); + final MutableGraphicsConfiguration msConfig = (MutableGraphicsConfiguration) surface.getGraphicsConfiguration(); + if(realized) { + parent.setRealized(true); + origParentChosenCaps = (GLCapabilitiesImmutable) msConfig.getChosenCapabilities(); + final GLCapabilities chosenFBOCaps = (GLCapabilities) origParentChosenCaps.cloneMutable(); + chosenFBOCaps.copyFrom(getRequestedGLCapabilities()); + msConfig.setChosenCapabilities(chosenFBOCaps); + } else { + msConfig.setChosenCapabilities(origParentChosenCaps); + parent.setRealized(false); + } } @Override -- cgit v1.2.3