diff options
Diffstat (limited to 'make')
-rw-r--r-- | make/build-jogl.xml | 5 | ||||
-rw-r--r-- | make/build-nativewindow.xml | 13 | ||||
-rw-r--r-- | make/build-newt.xml | 2 | ||||
-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/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 | ||||
-rwxr-xr-x | make/scripts/tests-x64.bat | 6 | ||||
-rwxr-xr-x | make/scripts/tests.sh | 12 | ||||
-rw-r--r-- | make/stub_includes/jni/macosx/jawt_md.h | 20 | ||||
-rw-r--r-- | make/stub_includes/macosx/AppKit/NSOpenGL.h | 3 | ||||
-rw-r--r-- | make/stub_includes/macosx/AppKit/NSOpenGLLayer.h | 1 | ||||
-rw-r--r-- | make/stub_includes/macosx/AppKit/NSOpenGLView.h | 1 | ||||
-rw-r--r-- | make/stub_includes/macosx/OpenGL/CGLDevice.h | 2 | ||||
-rw-r--r-- | make/stub_includes/macosx/OpenGL/OpenGL.h | 31 | ||||
-rw-r--r-- | make/stub_includes/macosx/QuartzCore/CALayer.h | 1 | ||||
-rw-r--r-- | make/stub_includes/opengl/macosx-window-system.h | 70 |
19 files changed, 184 insertions, 96 deletions
diff --git a/make/build-jogl.xml b/make/build-jogl.xml index 58e018024..511f147be 100644 --- a/make/build-jogl.xml +++ b/make/build-jogl.xml @@ -1130,6 +1130,8 @@ <linker id="linker.cfg.macosx.jogl" extends="linker.cfg.macosx"> <linkerarg value="-framework" /> + <linkerarg value="QuartzCore" /> + <linkerarg value="-framework" /> <linkerarg value="Cocoa" /> <linkerarg value="-framework" /> <linkerarg value="OpenGL" /> @@ -1276,8 +1278,10 @@ <patternset id="c.src.files.jogl.desktop"> <include name="${rootrel.src.c}/JoglCommon.c"/> <include name="${rootrel.src.c}/GLDebugMessageHandler.c"/> + <include name="${rootrel.src.c}/timespec.c" if="isOSX"/> <!-- currently only used for OSX --> <include name="${rootrel.src.c}/macosx/MacOSXCustomCGLCode.c" if="isOSX"/> <include name="${rootrel.src.c}/macosx/MacOSXWindowSystemInterface.m" if="isOSX"/> + <include name="${rootrel.src.c}/macosx/MacOSXWindowSystemInterface-pbuffer.m" if="isOSX"/> <include name="${rootrel.src.c}/macosx/ContextUpdater.m" if="isOSX"/> <include name="${rootrel.src.c}/GLXGetProcAddressARB.c" if="isX11"/> <!-- FIXME: the Mixer should be moved to another library --> @@ -1349,6 +1353,7 @@ <includepath path="stub_includes/cg" if="setup.addNativeNVidiaCG"/> <!-- This is for the generated headers for handwritten C code --> + <includepath path="${src.c}"/> <includepath path="${src.generated.c}" /> <includepath path="${src.generated.c}/X11" if="isX11"/> <includepath path="${src.generated.c}/MacOSX" if="isOSX"/> diff --git a/make/build-nativewindow.xml b/make/build-nativewindow.xml index 4bbe667b8..9d0dff406 100644 --- a/make/build-nativewindow.xml +++ b/make/build-nativewindow.xml @@ -354,6 +354,10 @@ <compilerarg value="-I/usr/X11R6/include" /> </compiler> + <compiler id="compiler.cfg.macosx.nativewindow" extends="compiler.cfg.macosx"> + <compilerarg value="-I${java.osx.frameworks.dir}/JavaNativeFoundation.framework/Headers" /> + </compiler> + <!-- linker configuration --> <linker id="linker.cfg.freebsd.nativewindow.x11" extends="linker.cfg.freebsd"> @@ -443,7 +447,13 @@ <linker id="linker.cfg.macosx.nativewindow" extends="linker.cfg.macosx"> <linkerarg value="-framework" /> + <linkerarg value="QuartzCore" /> + <linkerarg value="-framework" /> <linkerarg value="Cocoa" /> + <linkerarg value="-framework" /> + <linkerarg value="JavaNativeFoundation" /> + <linkerarg value="-F" /> + <linkerarg value="${java.osx.frameworks.dir}" /> </linker> <linker id="linker.cfg.hpux.nativewindow" extends="linker.cfg.hpux"> @@ -547,7 +557,7 @@ <target name="c.configure.x11" if="isX11" /> <target name="c.configure.macosx" if="isOSX"> - <property name="compiler.cfg.id" value="compiler.cfg.macosx" /> + <property name="compiler.cfg.id" value="compiler.cfg.macosx.nativewindow" /> <property name="linker.cfg.id.oswin" value="linker.cfg.macosx.nativewindow" /> </target> @@ -734,6 +744,7 @@ <target name="c.build.nativewindow.windowlib.macosx" if="isOSX"> <javah destdir="${src.generated.c}/MacOSX" classpath="${javah.classpath}" class="jogamp.nativewindow.macosx.OSXUtil" /> + <javah destdir="${src.generated.c}/MacOSX" classpath="${javah.classpath}" class="jogamp.nativewindow.jawt.macosx.MacOSXJAWTWindow" /> <c.build c.compiler.src.files="c.src.files.macosx" output.lib.name="nativewindow_macosx" diff --git a/make/build-newt.xml b/make/build-newt.xml index d3248fa9d..56ebfaccc 100644 --- a/make/build-newt.xml +++ b/make/build-newt.xml @@ -96,7 +96,7 @@ <!-- partitioning --> <property name="java.part.core" - value="com/jogamp/newt/* com/jogamp/newt/event/* com/jogamp/newt/util/* jogamp/newt/* jogamp/newt/event/*"/> + value="com/jogamp/newt/* com/jogamp/newt/event/* com/jogamp/newt/util/* jogamp/newt/* jogamp/newt/event/* jogamp/newt/driver/*"/> <property name="java.part.opengl" value="com/jogamp/newt/opengl/**"/> 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 diff --git a/make/scripts/tests-x64.bat b/make/scripts/tests-x64.bat index b45b49e89..d8bf861e0 100755 --- a/make/scripts/tests-x64.bat +++ b/make/scripts/tests-x64.bat @@ -12,7 +12,7 @@ REM scripts\java-win64-dbg.bat com.jogamp.opengl.test.junit.jogl.acore.TestGLPro REM scripts\java-win64-dbg.bat com.jogamp.opengl.test.junit.jogl.demos.gl2.newt.TestGearsNewtAWTWrapper %1 %2 %3 %4 %5 %6 REM scripts\java-win64-dbg.bat com.jogamp.opengl.test.junit.jogl.demos.gl2.newt.TestGearsNEWT -time 30000 REM scripts\java-win64-dbg.bat com.jogamp.opengl.test.junit.jogl.demos.es1.newt.TestGearsES1NEWT %1 %2 %3 -scripts\java-win64-dbg.bat com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestGearsES2NEWT %1 %2 %3 %4 %5 %6 +REM scripts\java-win64-dbg.bat com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestGearsES2NEWT %1 %2 %3 %4 %5 %6 REM scripts\java-win64-dbg.bat com.jogamp.opengl.test.junit.jogl.demos.gl2.awt.TestGearsAWT -time 5000 REM scripts\java-win64-dbg.bat com.jogamp.opengl.test.junit.jogl.demos.gl2.awt.TestGearsGLJPanelAWT -time 5000 REM scripts\java-win64-dbg.bat com.jogamp.opengl.test.junit.jogl.awt.TestAWT03GLCanvasRecreate01 @@ -30,10 +30,12 @@ REM scripts\java-win64-dbg.bat com.jogamp.opengl.test.junit.newt.TestWindows01NE REM scripts\java-win64-dbg.bat com.jogamp.opengl.test.junit.newt.TestGLWindows01NEWT REM scripts\java-win64-dbg.bat com.jogamp.opengl.test.junit.newt.TestGLWindows02NEWTAnimated REM scripts\java-win64-dbg.bat com.jogamp.opengl.test.junit.newt.parenting.TestParenting01NEWT -REM scripts\java-win64-dbg.bat com.jogamp.opengl.test.junit.newt.TestFocus02SwingAWTRobot REM scripts\java-win64-dbg.bat com.jogamp.opengl.test.junit.newt.TestFocus01SwingAWTRobot %1 %2 %3 %4 %5 %6 +REM scripts\java-win64-dbg.bat com.jogamp.opengl.test.junit.newt.TestFocus02SwingAWTRobot %1 %2 %3 %4 %5 %6 REM scripts\java-win64-dbg.bat com.jogamp.opengl.test.junit.nativewindow.TestRecursiveToolkitLockCORE REM scripts\java-win64-dbg.bat com.jogamp.opengl.test.junit.newt.parenting.TestParenting03AWT -time 100000 +scripts\java-win64-dbg.bat com.jogamp.opengl.test.junit.newt.parenting.TestParentingFocusTraversal01AWT %1 %2 %3 +REM scripts\java-win64-dbg.bat com.jogamp.opengl.test.junit.newt.parenting.TestParentingOffscreenLayer01AWT %1 %2 %3 REM scripts\java-win64-dbg.bat com.jogamp.opengl.test.junit.newt.parenting.TestParenting03bAWT -time 100000 REM scripts\java-win64.bat com.jogamp.opengl.test.junit.newt.TestFocus02SwingAWTRobot diff --git a/make/scripts/tests.sh b/make/scripts/tests.sh index cbea43cc9..4fc859829 100755 --- a/make/scripts/tests.sh +++ b/make/scripts/tests.sh @@ -49,7 +49,7 @@ function jrun() { shift #D_ARGS="-Djogl.debug.ExtensionAvailabilityCache -Djogl.debug=all -Dnativewindow.debug=all -Djogamp.debug.ProcAddressHelper=true -Djogamp.debug.NativeLibrary=true -Djogamp.debug.NativeLibrary.Lookup=true" - D_ARGS="-Dnativewindow.debug=all" + #D_ARGS="-Dnativewindow.debug=all -Djogl.debug.GLContext -Djogl.debug.GLDrawable -Dnewt.debug.Window" #D_ARGS="-Djogl.debug=all -Dnativewindow.debug=all" #D_ARGS="-Djogl.debug.GLContext -Djogl.debug.ExtensionAvailabilityCache" #D_ARGS="-Djogl.debug.GLContext -Djogl.debug.GLProfile -Djogl.debug.GLDrawable" @@ -75,7 +75,7 @@ function jrun() { #D_ARGS="-Djogl.debug=all -Dnewt.debug=all" #D_ARGS="-Dnewt.debug.Window -Dnewt.debug.Display -Dnewt.debug.EDT -Djogl.debug.GLContext" #D_ARGS="-Dnewt.debug.Window -Djogl.debug.Animator -Dnewt.debug.Screen" - #D_ARGS="-Dnewt.debug.Window" + D_ARGS="-Dnewt.debug.Window -Dnewt.debug.Window.KeyEvent" #D_ARGS="-Dnewt.debug.Window.MouseEvent" #D_ARGS="-Xprof" #D_ARGS="-Djogl.debug.Animator" @@ -223,13 +223,16 @@ function testswt() { #testawt com.jogamp.opengl.test.junit.jogl.demos.gl2.newt.TestGearsNewtAWTWrapper #testawt com.jogamp.opengl.test.junit.newt.TestEventSourceNotAWTBug #testawt com.jogamp.opengl.test.junit.newt.TestFocus01SwingAWTRobot $* -#testawt com.jogamp.opengl.test.junit.newt.TestFocus02SwingAWTRobot +#testawt com.jogamp.opengl.test.junit.newt.TestFocus02SwingAWTRobot $* #testawt com.jogamp.opengl.test.junit.newt.TestListenerCom01AWT #testawt com.jogamp.opengl.test.junit.newt.parenting.TestParenting01aAWT $* #testawt com.jogamp.opengl.test.junit.newt.parenting.TestParenting01bAWT $* #testawt com.jogamp.opengl.test.junit.newt.parenting.TestParenting01cAWT $* #testawt com.jogamp.opengl.test.junit.newt.parenting.TestParenting01cSwingAWT $* -testawt com.jogamp.opengl.test.junit.newt.parenting.TestParenting03AWT $* +#testawt com.jogamp.opengl.test.junit.newt.parenting.TestParenting02AWT $* +#testawt com.jogamp.opengl.test.junit.newt.parenting.TestParenting03AWT $* +testawt com.jogamp.opengl.test.junit.newt.parenting.TestParentingFocusTraversal01AWT $* +#testawt com.jogamp.opengl.test.junit.newt.parenting.TestParentingOffscreenLayer01AWT $* #testawt com.jogamp.opengl.test.junit.newt.parenting.TestTranslucentParentingAWT $* #testawt com.jogamp.opengl.test.junit.newt.TestCloseNewtAWT #testawt com.jogamp.opengl.test.junit.jogl.caps.TestMultisampleAWT $* @@ -273,6 +276,7 @@ testawt com.jogamp.opengl.test.junit.newt.parenting.TestParenting03AWT $* # # regressions # +#testawt com.jogamp.opengl.test.junit.newt.parenting.TestParentingOffscreenLayer01AWT $* $spath/count-edt-start.sh java-run.log diff --git a/make/stub_includes/jni/macosx/jawt_md.h b/make/stub_includes/jni/macosx/jawt_md.h index aca47f66e..3a371af0d 100644 --- a/make/stub_includes/jni/macosx/jawt_md.h +++ b/make/stub_includes/jni/macosx/jawt_md.h @@ -9,17 +9,35 @@ #include <jawt.h> #include <AppKit/NSView.h> +#include <QuartzCore/CALayer.h> #ifdef __cplusplus extern "C" { #endif +/** + * JAWT_DrawingSurfaceInfo.getPlatformInfo() + * + * Only if not JAWT_SurfaceLayers, see below! + */ typedef struct JAWT_MacOSXDrawingSurfaceInfo { - NSView *cocoaViewRef; // the view is guaranteed to be valid only for the duration of Component.paint method + /** the view is guaranteed to be valid only for the duration of Component.paint method */ + NSView *cocoaViewRef; } JAWT_MacOSXDrawingSurfaceInfo; +/** + * JAWT_DrawingSurfaceInfo.getPlatformInfo() + * + * >= 10.6.4 if JAWT_MACOSX_USE_CALAYER is set in JAWT version + */ +typedef struct JAWT_SurfaceLayers +{ + CALayer *layer; +} +JAWT_SurfaceLayers; + #ifdef __cplusplus } #endif diff --git a/make/stub_includes/macosx/AppKit/NSOpenGL.h b/make/stub_includes/macosx/AppKit/NSOpenGL.h new file mode 100644 index 000000000..1b7656dc1 --- /dev/null +++ b/make/stub_includes/macosx/AppKit/NSOpenGL.h @@ -0,0 +1,3 @@ +typedef struct _NSOpenGLPixelFormat NSOpenGLPixelFormat; +typedef struct _NSOpenGLContext NSOpenGLContext; +typedef struct _NSOpenGLPixelBuffer NSOpenGLPixelBuffer; diff --git a/make/stub_includes/macosx/AppKit/NSOpenGLLayer.h b/make/stub_includes/macosx/AppKit/NSOpenGLLayer.h new file mode 100644 index 000000000..2e5e81a68 --- /dev/null +++ b/make/stub_includes/macosx/AppKit/NSOpenGLLayer.h @@ -0,0 +1 @@ +typedef struct _NSOpenGLLayer NSOpenGLLayer; diff --git a/make/stub_includes/macosx/AppKit/NSOpenGLView.h b/make/stub_includes/macosx/AppKit/NSOpenGLView.h new file mode 100644 index 000000000..6492287df --- /dev/null +++ b/make/stub_includes/macosx/AppKit/NSOpenGLView.h @@ -0,0 +1 @@ +typedef struct _NSOpenGLView NSOpenGLView; diff --git a/make/stub_includes/macosx/OpenGL/CGLDevice.h b/make/stub_includes/macosx/OpenGL/CGLDevice.h new file mode 100644 index 000000000..1d4170975 --- /dev/null +++ b/make/stub_includes/macosx/OpenGL/CGLDevice.h @@ -0,0 +1,2 @@ +typedef struct _cglShareGroupObj* CGLShareGroupObj; + diff --git a/make/stub_includes/macosx/OpenGL/OpenGL.h b/make/stub_includes/macosx/OpenGL/OpenGL.h index 1a3ddf203..33cfa46b6 100644 --- a/make/stub_includes/macosx/OpenGL/OpenGL.h +++ b/make/stub_includes/macosx/OpenGL/OpenGL.h @@ -2,10 +2,13 @@ OpenGL.h to expose portions of the low-level CGL API to Java */ /* Typedefs to get things working */ -typedef struct _cglObj* CGLContextObj; -typedef struct _cglObj* CGLShareGroupObj; -typedef struct _cglObj* CGLPBufferObj; -typedef struct _cglObj* CGLPixelFormatObj; +typedef struct _cglContextObj* CGLContextObj; +typedef struct _cglPBufferObj* CGLPBufferObj; +typedef struct _cglPixelFormatObj* CGLPixelFormatObj; + +typedef int GLint; /* 4-byte signed */ +typedef unsigned int GLenum; +typedef int GLsizei; /* 4-byte signed */ /* ** Attribute names for CGLChoosePixelFormat and CGLDescribePixelFormat. @@ -105,7 +108,7 @@ typedef enum _CGLContextParameter { /* Pixel format manipulation */ CGLError CGLChoosePixelFormat(const CGLPixelFormatAttribute *attribs, CGLPixelFormatObj *pix, - long *npix); + GLint *npix); CGLError CGLDestroyPixelFormat(CGLPixelFormatObj pix); CGLPixelFormatObj CGLGetPixelFormat ( CGLContextObj ctx ); @@ -123,16 +126,16 @@ CGLError CGLCopyContext ( CGLContextObj src, CGLContextObj dst, int mask ); CGLShareGroupObj CGLGetShareGroup(CGLContextObj ctx); -/* PBuffer manipulation */ -CGLError CGLCreatePBuffer(long width, - long height, - unsigned long target, - unsigned long internalFormat, - long max_level, +/* PBuffer manipulation (deprecated in 10.7) */ +CGLError CGLCreatePBuffer(GLsizei width, + GLsizei height, + GLenum target, + GLenum internalFormat, + GLint max_level, CGLPBufferObj* pbuffer); CGLError CGLDestroyPBuffer(CGLPBufferObj pbuffer); CGLError CGLSetPBuffer(CGLContextObj ctx, CGLPBufferObj pbuffer, - unsigned long face, - long level, - long screen); + GLenum face, + GLint level, + GLint screen); diff --git a/make/stub_includes/macosx/QuartzCore/CALayer.h b/make/stub_includes/macosx/QuartzCore/CALayer.h new file mode 100644 index 000000000..a5a6579a6 --- /dev/null +++ b/make/stub_includes/macosx/QuartzCore/CALayer.h @@ -0,0 +1 @@ +typedef struct _CALayer CALayer; diff --git a/make/stub_includes/opengl/macosx-window-system.h b/make/stub_includes/opengl/macosx-window-system.h index 65d8e41f7..347de6299 100644 --- a/make/stub_includes/opengl/macosx-window-system.h +++ b/make/stub_includes/opengl/macosx-window-system.h @@ -7,55 +7,63 @@ compilation then the build fails. */ +#include <AppKit/NSView.h> +#include <AppKit/NSOpenGL.h> +#include <AppKit/NSOpenGLView.h> +#include <AppKit/NSOpenGLLayer.h> +#include <OpenGL/CGLDevice.h> +#include <OpenGL/OpenGL.h> + typedef int Bool; // CGL .. -void CGLQueryPixelFormat(void* pixelFormat, int* iattrs, int niattrs, int* ivalues); +void CGLQueryPixelFormat(CGLPixelFormatObj fmt, int* iattrs, int niattrs, int* ivalues); // NS .. -void* createPixelFormat(int* iattrs, int niattrs, int* ivalues); -void queryPixelFormat(void* pixelFormat, int* iattrs, int niattrs, int* ivalues); -void deletePixelFormat(void* pixelFormat); +NSOpenGLPixelFormat* createPixelFormat(int* iattrs, int niattrs, int* ivalues); +void queryPixelFormat(NSOpenGLPixelFormat* fmt, int* iattrs, int niattrs, int* ivalues); +void deletePixelFormat(NSOpenGLPixelFormat* fmt); // NS .. -void *getCurrentContext(void); -void *getNSView(void* nsContext); +NSOpenGLContext* getCurrentContext(void); +CGLContextObj getCGLContext(NSOpenGLContext* ctx); +NSView* getNSView(NSOpenGLContext* ctx); -void* createContext(void* shareContext, - void* nsView, - void* pixelFormat, +NSOpenGLContext* createContext(NSOpenGLContext* shareContext, + NSView* nsView, + Bool isBackingLayerView, + NSOpenGLPixelFormat* pixelFormat, Bool opaque, int* viewNotReady); -void *getCGLContext(void* nsContext); -Bool makeCurrentContext(void* nsContext); -Bool clearCurrentContext(void *nsContext); -Bool deleteContext(void* nsContext, Bool releaseOnMainThread); -Bool flushBuffer(void* nsContext); -void setContextOpacity(void* nsContext, int opacity); -void updateContext(void* nsContext); -void copyContext(void* destContext, void* srcContext, int mask); - -void* updateContextRegister(void* nsContext, void* nsView); +Bool makeCurrentContext(NSOpenGLContext* ctx); +Bool clearCurrentContext(NSOpenGLContext *ctx); +Bool deleteContext(NSOpenGLContext* ctx, Bool releaseOnMainThread); +Bool flushBuffer(NSOpenGLContext* ctx); +void setContextOpacity(NSOpenGLContext* ctx, int opacity); +void updateContext(NSOpenGLContext* ctx); +void copyContext(NSOpenGLContext* dest, NSOpenGLContext* src, int mask); + +void* updateContextRegister(NSOpenGLContext* ctx, NSView* view); Bool updateContextNeedsUpdate(void* updater); void updateContextUnregister(void* updater); -void* createPBuffer(int renderTarget, int internalFormat, int width, int height); -Bool destroyPBuffer(void* pBuffer); -void setContextPBuffer(void* nsContext, void* pBuffer); -void setContextTextureImageToPBuffer(void* nsContext, void* pBuffer, int colorBuffer); +NSOpenGLPixelBuffer* createPBuffer(int renderTarget, int internalFormat, int width, int height); +Bool destroyPBuffer(NSOpenGLPixelBuffer* pBuffer); +void setContextPBuffer(NSOpenGLContext* ctx, NSOpenGLPixelBuffer* pBuffer); +void setContextTextureImageToPBuffer(NSOpenGLContext* ctx, NSOpenGLPixelBuffer* pBuffer, GLenum colorBuffer); + +// NSOpenGLLayer* createNSOpenGLLayer(NSOpenGLContext* ctx, NSOpenGLPixelFormat* fmt, NSView* view, Bool opaque); +NSOpenGLLayer* createNSOpenGLLayer(NSOpenGLContext* ctx, NSOpenGLPixelFormat* fmt, NSOpenGLPixelBuffer* pbuffer, Bool opaque, int texWidth, int texHeight); +void setNSOpenGLLayerSwapInterval(NSOpenGLLayer* layer, int interval); +void waitUntilNSOpenGLLayerIsReady(NSOpenGLLayer* layer, long to_ms); +void setNSOpenGLLayerNeedsDisplay(NSOpenGLLayer* glLayer); +void releaseNSOpenGLLayer(NSOpenGLLayer *glLayer); void* getProcAddress(const char *procName); -void setSwapInterval(void* nsContext, int interval); +void setSwapInterval(NSOpenGLContext* ctx, int interval); /* Gamma-related functionality */ Bool setGammaRamp(int tableSize, float* redRamp, float* greenRamp, float* blueRamp); void resetGammaRamp(); -/****************************************************************************************/ -/* Java2D/JOGL bridge support; need to be able to create pbuffers and - contexts using the CGL APIs to be able to share textures, etc. with - contexts created by Java2D/JOGL bridge, which are CGLContextObjs */ - -/* Pick up copies of CGL signatures from Mac OS X stub_includes/window-system-build directory */ -#include <OpenGL/OpenGL.h> |