diff options
Diffstat (limited to 'make/config')
-rw-r--r-- | make/config/jogl/cgl-macosx.cfg | 7 | ||||
-rw-r--r-- | make/config/jogl/gl-impl-CustomJavaCode-common.java | 5 | ||||
-rw-r--r-- | make/config/jogl/wgl-win32.cfg | 5 | ||||
-rw-r--r-- | make/config/nativewindow/jawt-CustomJavaCode.java | 57 | ||||
-rw-r--r-- | make/config/nativewindow/jawt-DrawingSurfaceInfo-CustomJavaCode.java | 37 | ||||
-rw-r--r-- | make/config/nativewindow/jawt-common.cfg | 2 | ||||
-rw-r--r-- | make/config/nativewindow/jawt-macosx.cfg | 5 | ||||
-rw-r--r-- | make/config/nativewindow/win32-CustomJavaCode.java | 58 | ||||
-rw-r--r-- | make/config/nativewindow/win32-lib.cfg | 4 |
9 files changed, 77 insertions, 103 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/jogl/wgl-win32.cfg b/make/config/jogl/wgl-win32.cfg index c7adffa7b..4d2fea5d0 100644 --- a/make/config/jogl/wgl-win32.cfg +++ b/make/config/jogl/wgl-win32.cfg @@ -3,6 +3,8 @@ JavaOutputDir gensrc/classes NativeOutputDir gensrc/native/jogl/Windows +ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/jogamp/nativewindow/windows/GDI.java + Package jogamp.opengl.windows.wgl JavaClass WGL Style AllStatic @@ -21,6 +23,9 @@ EmitProcAddressTable true ProcAddressTableClassName WGLProcAddressTable GetProcAddressTableExpr wglProcAddressTable +Ignore PIXELFORMATDESCRIPTOR + +Import jogamp.nativewindow.windows.PIXELFORMATDESCRIPTOR Import com.jogamp.gluegen.runtime.opengl.GLProcAddressResolver CustomJavaCode WGL private static WGLProcAddressTable wglProcAddressTable = new WGLProcAddressTable(new GLProcAddressResolver()); 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 diff --git a/make/config/nativewindow/win32-CustomJavaCode.java b/make/config/nativewindow/win32-CustomJavaCode.java index e14e4d14c..5c484c2fe 100644 --- a/make/config/nativewindow/win32-CustomJavaCode.java +++ b/make/config/nativewindow/win32-CustomJavaCode.java @@ -1,60 +1,2 @@ - private static final boolean DEBUG = Debug.debug("GDI"); - - private static final String dummyWindowClassNameBase = "_dummyWindow_clazz" ; - private static RegisteredClassFactory dummyWindowClassFactory; - private static boolean isInit = false; - - private static native boolean initIDs0(); - private static native long getDummyWndProc0(); - - public static synchronized void initSingleton(boolean firstX11ActionOnProcess) { - if(!isInit) { - NWJNILibLoader.loadNativeWindow("win32"); - - if( !initIDs0() ) { - throw new NativeWindowException("GDI: Could not initialized native stub"); - } - - if(DEBUG) { - System.out.println("GDI.isFirstX11ActionOnProcess: "+firstX11ActionOnProcess); - } - - dummyWindowClassFactory = new RegisteredClassFactory(dummyWindowClassNameBase, getDummyWndProc0()); - isInit = true; - } - } - - public static boolean requiresToolkitLock() { return false; } - - private static RegisteredClass dummyWindowClass = null; - private static Object dummyWindowSync = new Object(); - - public static long CreateDummyWindow(int x, int y, int width, int height) { - synchronized(dummyWindowSync) { - dummyWindowClass = dummyWindowClassFactory.getSharedClass(); - return CreateDummyWindow0(dummyWindowClass.getHandle(), dummyWindowClass.getName(), dummyWindowClass.getName(), x, y, width, height); - } - } - - public static boolean DestroyDummyWindow(long hwnd) { - boolean res; - synchronized(dummyWindowSync) { - if( null == dummyWindowClass ) { - throw new InternalError("GDI Error ("+dummyWindowClassFactory.getSharedRefCount()+"): SharedClass is null"); - } - res = DestroyWindow(hwnd); - dummyWindowClassFactory.releaseSharedClass(); - } - return res; - } - - public static Point GetRelativeLocation(long src_win, long dest_win, int src_x, int src_y) { - return (Point) GetRelativeLocation0(src_win, dest_win, src_x, src_y); - } - private static native Object GetRelativeLocation0(long src_win, long dest_win, int src_x, int src_y); - - public static native boolean CreateWindowClass(long hInstance, String clazzName, long wndProc); - public static native boolean DestroyWindowClass(long hInstance, String className); - static native long CreateDummyWindow0(long hInstance, String className, String windowName, int x, int y, int width, int height); diff --git a/make/config/nativewindow/win32-lib.cfg b/make/config/nativewindow/win32-lib.cfg index b8ff42473..26c744a80 100644 --- a/make/config/nativewindow/win32-lib.cfg +++ b/make/config/nativewindow/win32-lib.cfg @@ -36,7 +36,5 @@ CustomCCode #include <gluegen_stddef.h> CustomCCode #include <wingdi.h> CustomCCode #include "WindowsDWM.h" -CustomCCode extern HINSTANCE GetApplicationHandle(); - -IncludeAs CustomJavaCode GDI win32-CustomJavaCode.java +CustomCCode extern HINSTANCE GetApplicationHandle(); |