aboutsummaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/javax/media/opengl
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2014-08-31 05:53:28 +0200
committerSven Gothel <[email protected]>2014-08-31 05:53:28 +0200
commitab07820e346f23aabc9d9364b7205017422cfaed (patch)
treeb7be20cae0a5e9b1438a51eecc110f019adc8001 /src/jogl/classes/javax/media/opengl
parent359ecbdd9cefaabeb1050be706ddeb020e5b6c37 (diff)
Bug 1020 - First MSAA FBO frame on a mac osx nvidia card not antialiased
OSX/Nvidia's FBO needs to be cleared before blitting, otherwise first MSAA frame lacks antialiasing. GLFBODrawableImpl.initialize(..) can clear GL.GL_COLOR_BUFFER_BIT and GL.GL_DEPTH_BUFFER_BIT, if used. FBObject cannot clear the buffer(s) due to it's low-level API, i.e. it cannot know when the first bind occurs _after_ user completed FBO setup (attaching buffers). Hence plain FBObject usage required manual injection of glClear(..) after setup as demonstrated in GLJPanel. We may need to elaborate in this case, i.e. add an FBObject API entry like 'fbo.postInitNotify()'.
Diffstat (limited to 'src/jogl/classes/javax/media/opengl')
-rw-r--r--src/jogl/classes/javax/media/opengl/awt/GLJPanel.java6
1 files changed, 6 insertions, 0 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());