summaryrefslogtreecommitdiffstats
path: root/make/config
diff options
context:
space:
mode:
Diffstat (limited to 'make/config')
-rw-r--r--make/config/jogl/cgl-macosx.cfg7
-rw-r--r--make/config/jogl/gl-impl-CustomJavaCode-common.java5
-rw-r--r--make/config/nativewindow/jawt-CustomJavaCode.java57
-rw-r--r--make/config/nativewindow/jawt-DrawingSurfaceInfo-CustomJavaCode.java37
-rw-r--r--make/config/nativewindow/jawt-common.cfg2
-rw-r--r--make/config/nativewindow/jawt-macosx.cfg5
6 files changed, 71 insertions, 42 deletions
diff --git a/make/config/jogl/cgl-macosx.cfg b/make/config/jogl/cgl-macosx.cfg
index 06bc94626..7d17c4aff 100644
--- a/make/config/jogl/cgl-macosx.cfg
+++ b/make/config/jogl/cgl-macosx.cfg
@@ -20,6 +20,13 @@ Opaque long CGLShareGroupObj
Opaque long CGLPBufferObj
Opaque long CGLPixelFormatObj
+Opaque long NSOpenGLPixelFormat *
+Opaque long NSOpenGLContext *
+Opaque long NSView *
+Opaque long NSOpenGLView *
+Opaque long NSOpenGLPixelBuffer *
+Opaque long NSOpenGLLayer *
+
CustomCCode #include </usr/include/machine/types.h>
CustomCCode #include "macosx-window-system.h"
diff --git a/make/config/jogl/gl-impl-CustomJavaCode-common.java b/make/config/jogl/gl-impl-CustomJavaCode-common.java
index 0a8e90171..0878bd236 100644
--- a/make/config/jogl/gl-impl-CustomJavaCode-common.java
+++ b/make/config/jogl/gl-impl-CustomJavaCode-common.java
@@ -35,6 +35,11 @@
return _context.isExtensionAvailable(glExtensionName);
}
+ public boolean isNPOTTextureAvailable() {
+ return isGL3() || isGLES2() || isExtensionAvailable(GL_ARB_texture_non_power_of_two);
+ }
+ private static final String GL_ARB_texture_non_power_of_two = "GL_ARB_texture_non_power_of_two";
+
public Object getExtension(String extensionName) {
// At this point we don't expose any extensions using this mechanism
return null;
diff --git a/make/config/nativewindow/jawt-CustomJavaCode.java b/make/config/nativewindow/jawt-CustomJavaCode.java
index 3223a74b1..d3dc3845f 100644
--- a/make/config/nativewindow/jawt-CustomJavaCode.java
+++ b/make/config/nativewindow/jawt-CustomJavaCode.java
@@ -1,27 +1,38 @@
-private static volatile JAWT jawt;
+/** Available and recommended on Mac OS X >= 10.6 Update 4 */
+public static final int JAWT_MACOSX_USE_CALAYER = 0x80000000;
+public static final VersionNumber JAWT_MacOSXCALayerMinVersion = new VersionNumber(10,6,4);
+
+private int jawt_version_cached = 0;
+
+public final int getCachedVersion() {
+ return jawt_version_cached;
+}
/** Helper routine for all users to call to access the JAWT. */
-public static JAWT getJAWT() {
- if (jawt == null) {
- synchronized (JAWT.class) {
- if (jawt == null) {
- JAWTUtil.initSingleton();
- // Workaround for 4845371.
- // Make sure the first reference to the JNI GetDirectBufferAddress is done
- // from a privileged context so the VM's internal class lookups will succeed.
- AccessController.doPrivileged(new PrivilegedAction() {
- public Object run() {
- JAWT j = JAWT.create();
- j.setVersion(JAWTFactory.JAWT_VERSION_1_4);
- if (!JAWTFactory.JAWT_GetAWT(j)) {
- throw new RuntimeException("Unable to initialize JAWT");
+public static JAWT getJAWT(final int jawt_version_flags) {
+ JAWTUtil.initSingleton();
+ // Workaround for 4845371.
+ // Make sure the first reference to the JNI GetDirectBufferAddress is done
+ // from a privileged context so the VM's internal class lookups will succeed.
+ return AccessController.doPrivileged(new PrivilegedAction<JAWT>() {
+ public JAWT run() {
+ int jawt_version_flags_mod = jawt_version_flags;
+ JAWT jawt = JAWT.create();
+ if( 0 != ( jawt_version_flags_mod & JAWT_MACOSX_USE_CALAYER ) ) {
+ jawt.setVersion(jawt_version_flags_mod);
+ if (JAWTFactory.JAWT_GetAWT(jawt)) {
+ jawt.jawt_version_cached = jawt.getVersion();
+ return jawt;
}
- jawt = j;
- return null;
- }
- });
- }
- }
- }
- return jawt;
+ jawt_version_flags_mod &= ~JAWT_MACOSX_USE_CALAYER;
+ System.err.println("MacOSX "+Platform.OS_VERSION_NUMBER+" >= "+JAWT_MacOSXCALayerMinVersion+": Failed to use JAWT_MACOSX_USE_CALAYER");
+ }
+ jawt.setVersion(jawt_version_flags_mod);
+ if (!JAWTFactory.JAWT_GetAWT(jawt)) {
+ throw new RuntimeException("Unable to initialize JAWT: 0x"+Integer.toHexString(jawt_version_flags_mod));
+ }
+ jawt.jawt_version_cached = jawt.getVersion();
+ return jawt;
+ }
+ });
}
diff --git a/make/config/nativewindow/jawt-DrawingSurfaceInfo-CustomJavaCode.java b/make/config/nativewindow/jawt-DrawingSurfaceInfo-CustomJavaCode.java
index 598ced346..4ff3a45b0 100644
--- a/make/config/nativewindow/jawt-DrawingSurfaceInfo-CustomJavaCode.java
+++ b/make/config/nativewindow/jawt-DrawingSurfaceInfo-CustomJavaCode.java
@@ -1,30 +1,29 @@
-public JAWT_PlatformInfo platformInfo() {
- return newPlatformInfo(platformInfo0(getBuffer()));
+public JAWT_PlatformInfo platformInfo(final JAWT jawt) {
+ return newPlatformInfo(jawt, platformInfo0(getBuffer()));
}
private native ByteBuffer platformInfo0(Buffer jthis0);
private static java.lang.reflect.Method platformInfoFactoryMethod;
-private static JAWT_PlatformInfo newPlatformInfo(ByteBuffer buf) {
+private static JAWT_PlatformInfo newPlatformInfo(JAWT jawt, ByteBuffer buf) {
if (platformInfoFactoryMethod == null) {
- String osName = (String) AccessController.doPrivileged(new PrivilegedAction() {
- public Object run() {
- return System.getProperty("os.name").toLowerCase();
- }
- });
try {
- Class factoryClass;
- if (osName.startsWith("wind")) {
- factoryClass = Class.forName("jogamp.nativewindow.jawt.windows.JAWT_Win32DrawingSurfaceInfo");
- } else if (osName.startsWith("mac os x")) {
- factoryClass = Class.forName("jogamp.nativewindow.jawt.macosx.JAWT_MacOSXDrawingSurfaceInfo");
- } else {
- // Assume Linux, Solaris, etc. Should probably test for these explicitly.
- factoryClass = Class.forName("jogamp.nativewindow.jawt.x11.JAWT_X11DrawingSurfaceInfo");
- }
- platformInfoFactoryMethod = factoryClass.getMethod("create",
- new Class[] { ByteBuffer.class });
+ Class<?> factoryClass;
+ if (Platform.OS_TYPE == Platform.OSType.WINDOWS) {
+ factoryClass = Class.forName("jogamp.nativewindow.jawt.windows.JAWT_Win32DrawingSurfaceInfo");
+ } else if (Platform.OS_TYPE == Platform.OSType.MACOS) {
+ if( 0 != ( jawt.getCachedVersion() & JAWT.JAWT_MACOSX_USE_CALAYER ) ) {
+ factoryClass = Class.forName("jogamp.nativewindow.jawt.macosx.JAWT_SurfaceLayers");
+ } else {
+ factoryClass = Class.forName("jogamp.nativewindow.jawt.macosx.JAWT_MacOSXDrawingSurfaceInfo");
+ }
+ } else {
+ // Assume Linux, Solaris, etc. Should probably test for these explicitly.
+ factoryClass = Class.forName("jogamp.nativewindow.jawt.x11.JAWT_X11DrawingSurfaceInfo");
+ }
+ platformInfoFactoryMethod = factoryClass.getMethod("create",
+ new Class[] { ByteBuffer.class });
} catch (Exception e) {
throw new RuntimeException(e);
}
diff --git a/make/config/nativewindow/jawt-common.cfg b/make/config/nativewindow/jawt-common.cfg
index d633c47d6..55f3f368b 100644
--- a/make/config/nativewindow/jawt-common.cfg
+++ b/make/config/nativewindow/jawt-common.cfg
@@ -22,5 +22,7 @@ CustomCCode #include <jawt.h>
import java.security.*
import jogamp.nativewindow.jawt.*
+import com.jogamp.common.os.Platform
+import com.jogamp.common.util.VersionNumber
IncludeAs CustomJavaCode JAWT_DrawingSurfaceInfo jawt-DrawingSurfaceInfo-CustomJavaCode.java
diff --git a/make/config/nativewindow/jawt-macosx.cfg b/make/config/nativewindow/jawt-macosx.cfg
index c41367f4a..20260f693 100644
--- a/make/config/nativewindow/jawt-macosx.cfg
+++ b/make/config/nativewindow/jawt-macosx.cfg
@@ -5,6 +5,7 @@ NativeOutputDir gensrc/native/MacOSX
Opaque long void *
Opaque long NSView *
+Opaque long CALayer *
CustomCCode #include <inttypes.h>
CustomCCode #include </usr/include/machine/types.h>
@@ -12,3 +13,7 @@ CustomCCode #include </usr/include/machine/types.h>
StructPackage JAWT_MacOSXDrawingSurfaceInfo jogamp.nativewindow.jawt.macosx
EmitStruct JAWT_MacOSXDrawingSurfaceInfo
Implements JAWT_MacOSXDrawingSurfaceInfo JAWT_PlatformInfo
+
+StructPackage JAWT_SurfaceLayers jogamp.nativewindow.jawt.macosx
+EmitStruct JAWT_SurfaceLayers
+Implements JAWT_SurfaceLayers JAWT_PlatformInfo