diff options
author | Sven Gothel <[email protected]> | 2014-08-31 05:53:28 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2014-08-31 05:53:28 +0200 |
commit | ab07820e346f23aabc9d9364b7205017422cfaed (patch) | |
tree | b7be20cae0a5e9b1438a51eecc110f019adc8001 /src/jogl/classes/jogamp/opengl | |
parent | 359ecbdd9cefaabeb1050be706ddeb020e5b6c37 (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/jogamp/opengl')
-rw-r--r-- | src/jogl/classes/jogamp/opengl/GLFBODrawableImpl.java | 14 |
1 files changed, 12 insertions, 2 deletions
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 { |