From 946c98fd196802755e9e13a9c5db75650a564466 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Thu, 13 Oct 2011 03:33:28 +0200 Subject: 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. --- src/jogl/native/macosx/ContextUpdater.h | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'src/jogl/native/macosx/ContextUpdater.h') diff --git a/src/jogl/native/macosx/ContextUpdater.h b/src/jogl/native/macosx/ContextUpdater.h index f8ce93def..2483ec403 100644 --- a/src/jogl/native/macosx/ContextUpdater.h +++ b/src/jogl/native/macosx/ContextUpdater.h @@ -22,10 +22,13 @@ This notification is sent whenever an NSView that has an attached NSSurface chan #define UNLOCK_GL(func, line) [ContextUpdater unlock]; #endif -// gznote: OpenGL NOT thread safe - need to sync on update and paints - @interface ContextUpdater : NSObject { +@protected + NSView * view; + NSRect viewRect; + NSOpenGLContext *ctx; + BOOL viewUpdated; } + (void) lock; @@ -33,8 +36,10 @@ This notification is sent whenever an NSView that has an attached NSSurface chan + (void) unlock; + (void) unlockInFunction:(char *)func atLine:(int)line; -- (void) registerFor:(NSOpenGLContext *)context with: (NSView *)window; +- (id) initWithContext:(NSOpenGLContext *)context view: (NSView *)nsView; - (void) update:(NSNotification *)notification; +- (BOOL) needsUpdate; + @end -- cgit v1.2.3