diff options
author | Sven Gothel <[email protected]> | 2011-10-13 03:33:28 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2011-10-13 03:33:28 +0200 |
commit | 946c98fd196802755e9e13a9c5db75650a564466 (patch) | |
tree | c3aa9b62a1cea7e3a2dc8c306decbbbe273f3b4c /src/jogl/classes/jogamp/opengl/GLContextImpl.java | |
parent | 22f8e786219166019688ff2eea6ff9570c117544 (diff) |
JOGL/OSX: Properly utilize NSOpenGLContext update() via ContextUpdater, which only holds the 'update' state now.
Avoid calling updater() for every makeCurrent(), but if view's frame has changed only.
This solves the pixel flickering experienced on OSX.
- GLContextImpl:update() -> drawableUpdatedNotify() w/ comments
- ContextUpdater holds context, view, old view frame and the update state.
It doesn't issue NSOpenGLContext update() by itself, but allows querying and clearing the update flag.
- MacOSXOnscreenCGLContext impl drawableUpdatedNotify()
- register via ContextUpdater, and use it if available.
Diffstat (limited to 'src/jogl/classes/jogamp/opengl/GLContextImpl.java')
-rw-r--r-- | src/jogl/classes/jogamp/opengl/GLContextImpl.java | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/src/jogl/classes/jogamp/opengl/GLContextImpl.java b/src/jogl/classes/jogamp/opengl/GLContextImpl.java index 99693aabe..283b0c751 100644 --- a/src/jogl/classes/jogamp/opengl/GLContextImpl.java +++ b/src/jogl/classes/jogamp/opengl/GLContextImpl.java @@ -196,8 +196,18 @@ public abstract class GLContextImpl extends GLContext { return gl; } - // This is only needed for Mac OS X on-screen contexts - protected void update() throws GLException { } + /** + * Call this method to notify the OpenGL context + * that the drawable has changed (size or position). + * + * <p> + * This is currently being used and overridden by Mac OSX, + * which issues the {@link jogamp.opengl.macosx.cgl.CGL#updateContext(long) NSOpenGLContext update()} call. + * </p> + * + * @throws GLException + */ + protected void drawableUpdatedNotify() throws GLException { } boolean lockFailFast = true; Object lockFailFastSync = new Object(); @@ -362,7 +372,7 @@ public abstract class GLContextImpl extends GLContext { if (current == this) { // Assume we don't need to make this context current again // For Mac OS X, however, we need to update the context to track resizes - update(); + drawableUpdatedNotify(); return CONTEXT_CURRENT; } else { current.release(); |