summaryrefslogtreecommitdiffstats
path: root/src/jogl
diff options
context:
space:
mode:
Diffstat (limited to 'src/jogl')
-rw-r--r--src/jogl/classes/javax/media/opengl/awt/GLJPanel.java6
-rw-r--r--src/jogl/classes/jogamp/opengl/GLFBODrawableImpl.java14
2 files changed, 18 insertions, 2 deletions
diff --git a/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java b/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java
index e2ccc1097..cfb11a2b0 100644
--- a/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java
+++ b/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java
@@ -1636,6 +1636,11 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing
helper.setAutoSwapBufferMode(false); // we handle swap-buffers, see handlesSwapBuffer()
final GL gl = offscreenContext.getGL();
+ // Remedy for Bug 1020, i.e. OSX/Nvidia's FBO needs to be cleared before blitting,
+ // otherwise first MSAA frame lacks antialiasing.
+ // Clearing of FBO is performed within GLFBODrawableImpl.initialize(..):
+ // gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
+
final GLCapabilitiesImmutable chosenCaps = offscreenDrawable.getChosenGLCapabilities();
final boolean glslCompliant = !offscreenContext.hasRendererQuirk(GLRendererQuirks.GLSLNonCompliant);
final boolean useGLSLFlip = useGLSLFlip_pre && gl.isGL2ES2() && glslCompliant;
@@ -1653,6 +1658,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing
fboFlipped.reset(gl, fboDrawable.getSurfaceWidth(), fboDrawable.getSurfaceHeight(), 0, false);
fboFlipped.attachColorbuffer(gl, 0, chosenCaps.getAlphaBits()>0);
// fboFlipped.attachRenderbuffer(gl, Attachment.Type.DEPTH, 24);
+ gl.glClear(GL.GL_COLOR_BUFFER_BIT); // Bug 1020 (see above), cannot do in FBObject due to unknown 'first bind' state.
glslTextureRaster = new GLSLTextureRaster(fboDrawable.getTextureUnit(), true);
glslTextureRaster.init(gl.getGL2ES2());
glslTextureRaster.reshape(gl.getGL2ES2(), 0, 0, fboDrawable.getSurfaceWidth(), fboDrawable.getSurfaceHeight());
diff --git a/src/jogl/classes/jogamp/opengl/GLFBODrawableImpl.java b/src/jogl/classes/jogamp/opengl/GLFBODrawableImpl.java
index a779fed3b..9694ca9a9 100644
--- a/src/jogl/classes/jogamp/opengl/GLFBODrawableImpl.java
+++ b/src/jogl/classes/jogamp/opengl/GLFBODrawableImpl.java
@@ -60,9 +60,9 @@ public class GLFBODrawableImpl extends GLDrawableImpl implements GLFBODrawable {
private int fboIBack; // points to GL_BACK buffer
private int fboIFront; // points to GL_FRONT buffer
private int pendingFBOReset = -1;
- /** Indicated whether the FBO is bound. */
+ /** Indicates whether the FBO is bound. */
private boolean fboBound;
- /** Indicated whether the FBO is swapped, resets to false after makeCurrent -> contextMadeCurrent. */
+ /** Indicates whether the FBO is swapped, resets to false after makeCurrent -> contextMadeCurrent. */
private boolean fboSwapped;
/** dump fboResetQuirk info only once pre ClassLoader and only in DEBUG mode */
@@ -189,7 +189,17 @@ public class GLFBODrawableImpl extends GLDrawableImpl implements GLFBODrawable {
fbos[i].setSamplingSink(ssink);
fbos[i].resetSamplingSink(gl); // validate
}
+ // Clear the framebuffer allowing defined state not exposing previous content.
+ // Also remedy for Bug 1020, i.e. OSX/Nvidia's FBO needs to be cleared before blitting,
+ // otherwise first MSAA frame lacks antialiasing.
+ fbos[i].bind(gl);
+ if( useDepth ) {
+ gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
+ } else {
+ gl.glClear(GL.GL_COLOR_BUFFER_BIT);
+ }
}
+ fbos[fbosN-1].unbind(gl);
fbos[0].formatToGLCapabilities(chosenFBOCaps);
chosenFBOCaps.setDoubleBuffered( chosenFBOCaps.getDoubleBuffered() || samples > 0 );
} else {