diff options
author | Sven Gothel <[email protected]> | 2013-02-15 17:15:49 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2013-02-15 17:15:49 +0100 |
commit | 2aeff053c55dadafb94bfbba661250e0c96f1fe5 (patch) | |
tree | f65c8fd9a2ccd3b44bb90a59b99fe59fa58fcb88 /make/config/jogl/cgl-macosx-CustomJavaCode.java | |
parent | f6e6fab2a7ddfb5c9b614cb072c27ff697629161 (diff) |
Fix Bug 691 (part-2): Extra '[subLayer release]' is wrong, since 'CGL.releaseNSOpenGLLayer' triggers release - but very late w/ AWT usage.
OSXUtil_RemoveCASublayer0's added '[subLayer release]' in commit f6e6fab2a7ddfb5c9b614cb072c27ff697629161
is wrong, since 'CGL.releaseNSOpenGLLayer' actually does trigger it's release.
This was not seen w/ AWT tests, since it happens very later.
A NewtCanvasAWT test disclosed this error -> removed that extra release call.
The culprit for the late release w/ AWT usage was CGL.createNSOpenGLLayer's call in the current thread.
Moving it to the Main-Thread fixed the problem.
All CALayer lifecycle calls are issued on the Main-Thread now.
NSOpenGLLayer's CVDisplayLink OpenGL fitting via 'CVDisplayLinkSetCurrentCGDisplayFromOpenGLContext'
is now performed at it's context creation in 'NSOpenGLLayer::openGLContextForPixelFormat'.
The 'extra' release of the NSOpenGLLayer's NSOpenGLContext as introduced in commit f6e6fab2a7ddfb5c9b614cb072c27ff697629161
is still valid.
Diffstat (limited to 'make/config/jogl/cgl-macosx-CustomJavaCode.java')
-rw-r--r-- | make/config/jogl/cgl-macosx-CustomJavaCode.java | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/make/config/jogl/cgl-macosx-CustomJavaCode.java b/make/config/jogl/cgl-macosx-CustomJavaCode.java new file mode 100644 index 000000000..b9a37d0c6 --- /dev/null +++ b/make/config/jogl/cgl-macosx-CustomJavaCode.java @@ -0,0 +1,22 @@ + +/** + * Creates the NSOpenGLLayer for FBO/PBuffer w/ optional GL3 shader program on Main-Thread + */ +public static long createNSOpenGLLayer(final long ctx, final int gl3ShaderProgramName, final long fmt, final long p, + final int texID, final boolean opaque, final int texWidth, final int texHeight) { + return OSXUtil.RunOnMainThread(true, new Function<Long, Object>() { + public Long eval(Object... args) { + return Long.valueOf( createNSOpenGLLayerImpl(ctx, gl3ShaderProgramName, fmt, p, texID, opaque, texWidth, texHeight) ); + } } ).longValue(); +} + +/** + * Releases the NSOpenGLLayer on Main-Thread + */ +public static void releaseNSOpenGLLayer(final long nsOpenGLLayer) { + OSXUtil.RunOnMainThread(true, new Runnable() { + public void run() { + releaseNSOpenGLLayerImpl(nsOpenGLLayer); + } } ); +} + |