summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXOnscreenCGLContext.java18
-rw-r--r--src/jogl/native/macosx/ContextUpdater.m4
2 files changed, 16 insertions, 6 deletions
diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXOnscreenCGLContext.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXOnscreenCGLContext.java
index 97d198c92..de3e90c4c 100644
--- a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXOnscreenCGLContext.java
+++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXOnscreenCGLContext.java
@@ -57,7 +57,13 @@ public class MacOSXOnscreenCGLContext extends MacOSXCGLContext {
@Override
protected void drawableUpdatedNotify() throws GLException {
- if(0==updateHandle || CGL.updateContextNeedsUpdate(updateHandle)) {
+ final int w = drawable.getWidth();
+ final int h = drawable.getHeight();
+ final boolean updateContext = ( 0!=updateHandle && CGL.updateContextNeedsUpdate(updateHandle) ) ||
+ w != lastWidth || h != lastHeight;
+ if(updateContext) {
+ lastWidth = w;
+ lastHeight = h;
if (contextHandle == 0) {
throw new GLException("Context not created");
}
@@ -65,8 +71,6 @@ public class MacOSXOnscreenCGLContext extends MacOSXCGLContext {
}
}
- protected long updateHandle = 0;
-
@Override
protected boolean createImpl() {
boolean res = super.createImpl();
@@ -79,6 +83,9 @@ public class MacOSXOnscreenCGLContext extends MacOSXCGLContext {
throw new InternalError("XXX2");
}
}
+ updateHandle = 0;
+ lastWidth = -1;
+ lastHeight = -1;
return res;
}
@@ -89,5 +96,8 @@ public class MacOSXOnscreenCGLContext extends MacOSXCGLContext {
updateHandle = 0;
}
super.destroyImpl();
- }
+ }
+
+ private long updateHandle;
+ private int lastWidth, lastHeight;
}
diff --git a/src/jogl/native/macosx/ContextUpdater.m b/src/jogl/native/macosx/ContextUpdater.m
index 21f98ad5e..e0668352c 100644
--- a/src/jogl/native/macosx/ContextUpdater.m
+++ b/src/jogl/native/macosx/ContextUpdater.m
@@ -47,7 +47,7 @@ static void printLockDebugInfo(char *message, char *func, int line)
viewUpdated = TRUE;
viewRect = r;
}
-
+
[self unlock];
}
@@ -71,7 +71,7 @@ static void printLockDebugInfo(char *message, char *func, int line)
[ctx retain];
[view retain];
viewRect = [view frame];
- viewUpdated = FALSE;
+ viewUpdated = TRUE;
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(update:) name:NSViewGlobalFrameDidChangeNotification object: view];
return [super init];