diff options
Diffstat (limited to 'src/jogl')
-rw-r--r-- | src/jogl/classes/javax/media/opengl/GLFBODrawable.java | 4 | ||||
-rw-r--r-- | src/jogl/classes/jogamp/opengl/GLFBODrawableImpl.java | 19 |
2 files changed, 15 insertions, 8 deletions
diff --git a/src/jogl/classes/javax/media/opengl/GLFBODrawable.java b/src/jogl/classes/javax/media/opengl/GLFBODrawable.java index 45fd3b686..079d9af5c 100644 --- a/src/jogl/classes/javax/media/opengl/GLFBODrawable.java +++ b/src/jogl/classes/javax/media/opengl/GLFBODrawable.java @@ -39,7 +39,9 @@ import com.jogamp.opengl.FBObject.TextureAttachment; * * <p> * A {@link GLFBODrawable} is uninitialized until a {@link GLContext} is bound - * and made current the first time. + * and made current the first time, hence only then it's capabilities <i>fully</i> reflect expectations, + * i.e. color, depth, stencil and MSAA bits will be <i>valid</i> only after the first {@link GLContext#makeCurrent() makeCurrent()} call. + * On-/offscreen bits are <i>valid</i> after {@link #setRealized(boolean) setRealized(true)}. * </p> * * <p> 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 |