summaryrefslogtreecommitdiffstats
path: root/make/config
diff options
context:
space:
mode:
Diffstat (limited to 'make/config')
-rw-r--r--make/config/jogl/cgl-macosx-CustomJavaCode.java44
-rw-r--r--make/config/jogl/cgl-macosx.cfg11
2 files changed, 55 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..d32e0ae8f
--- /dev/null
+++ b/make/config/jogl/cgl-macosx-CustomJavaCode.java
@@ -0,0 +1,44 @@
+
+/**
+ * Creates the NSOpenGLLayer for FBO/PBuffer w/ optional GL3 shader program on Main-Thread
+ * <p>
+ * It is mandatory that the shared context handle <code>ctx</code>
+ * is not locked while calling this method.
+ * </p>
+ * <p>
+ * The NSOpenGLLayer starts in enabled mode,
+ * you may enable/disable it via {@link #setNSOpenGLLayerEnabled(long, boolean)}.
+ * </p>
+ */
+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();
+}
+
+/**
+ * Enable or disable NSOpenGLLayer.
+ *
+ * <p>
+ * If disabled, the NSOpenGLLayer will not be displayed, i.e. rendered.
+ * </p>
+ */
+public static void setNSOpenGLLayerEnabled(final long nsOpenGLLayer, final boolean enable) {
+ OSXUtil.RunOnMainThread(true, new Runnable() {
+ public void run() {
+ setNSOpenGLLayerEnabledImpl(nsOpenGLLayer, enable);
+ } } );
+}
+
+/**
+ * Releases the NSOpenGLLayer on Main-Thread
+ */
+public static void releaseNSOpenGLLayer(final long nsOpenGLLayer) {
+ OSXUtil.RunOnMainThread(true, new Runnable() {
+ public void run() {
+ releaseNSOpenGLLayerImpl(nsOpenGLLayer);
+ } } );
+}
+
diff --git a/make/config/jogl/cgl-macosx.cfg b/make/config/jogl/cgl-macosx.cfg
index 203802d29..edb5bfbbf 100644
--- a/make/config/jogl/cgl-macosx.cfg
+++ b/make/config/jogl/cgl-macosx.cfg
@@ -34,6 +34,15 @@ Opaque long NSOpenGLLayer *
CustomCCode #include </usr/include/machine/types.h>
CustomCCode #include "macosx-window-system.h"
+AccessControl createNSOpenGLLayerImpl PRIVATE
+AccessControl setNSOpenGLLayerEnabledImpl PRIVATE
+AccessControl releaseNSOpenGLLayerImpl PRIVATE
+RenameJavaMethod createNSOpenGLLayer createNSOpenGLLayerImpl
+RenameJavaMethod setNSOpenGLLayerEnabled setNSOpenGLLayerEnabledImpl
+RenameJavaMethod releaseNSOpenGLLayer releaseNSOpenGLLayerImpl
+
+IncludeAs CustomJavaCode CGL cgl-macosx-CustomJavaCode.java
+
# Implement the first argument to getProcAddress as String instead
# of byte[]
ArgumentIsString getProcAddress 0
@@ -53,3 +62,5 @@ DropUniqVendorExtensions SGIX
DropUniqVendorExtensions SUN
DropUniqVendorExtensions WIN
+Import com.jogamp.common.util.Function
+Import jogamp.nativewindow.macosx.OSXUtil