diff options
author | Kenneth Russel <[email protected]> | 2008-07-31 03:08:44 +0000 |
---|---|---|
committer | Kenneth Russel <[email protected]> | 2008-07-31 03:08:44 +0000 |
commit | 07a44e1d67b4f0ea2efb68c888cd8c6e1f7d2632 (patch) | |
tree | 26d15613f76f7c4f63ae3fd589045a52eb03eccf /src | |
parent | fda288da7746aefc3c9380aa63e02ad6da42ba5b (diff) |
Fixed loading of GLES and EGL libraries, and error reporting when none
available. Fixed building with -Djogl.cdcfp, in particular nested
building of gluegen. Took out call to SHFullScreen, which doesn't seem
to be available on the NVidia APX 2500 any more. Fixed #includes in
InternalBufferUtils.c.
git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/svn-server-sync/jogl/branches/JOGL_2_SANDBOX@1738 232f8b59-042b-4e1e-8c03-345bb8c30851
Diffstat (limited to 'src')
-rwxr-xr-x | src/classes/com/sun/opengl/impl/egl/EGLDrawableFactory.java | 38 | ||||
-rw-r--r-- | src/classes/javax/media/opengl/GLProfile.java | 12 | ||||
-rw-r--r-- | src/native/jogl/InternalBufferUtils.c | 17 | ||||
-rwxr-xr-x | src/native/newt/WindowsWindow.c | 22 |
4 files changed, 58 insertions, 31 deletions
diff --git a/src/classes/com/sun/opengl/impl/egl/EGLDrawableFactory.java b/src/classes/com/sun/opengl/impl/egl/EGLDrawableFactory.java index 9ff4b7eac..b7c62bfd0 100755 --- a/src/classes/com/sun/opengl/impl/egl/EGLDrawableFactory.java +++ b/src/classes/com/sun/opengl/impl/egl/EGLDrawableFactory.java @@ -43,7 +43,7 @@ import com.sun.gluegen.runtime.NativeLibrary; public class EGLDrawableFactory extends GLDrawableFactoryImpl { // We need more than one of these on certain devices (the NVidia APX 2500 in particular) - private List/*<NativeLibrary>*/ glesLibraries; + private List/*<NativeLibrary>*/ glesLibraries = new ArrayList(); public EGLDrawableFactory() { super(); @@ -52,11 +52,22 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { EGL.resetProcAddressTable(this); } + private NativeLibrary loadFirstAvailable(List/*<String>*/ libNames, ClassLoader loader) { + for (Iterator iter = libNames.iterator(); iter.hasNext(); ) { + NativeLibrary lib = NativeLibrary.open((String) iter.next(), loader); + if (lib != null) { + return lib; + } + } + return null; + } + private void loadGLESLibrary() { List/*<NativeLibrary>*/ libs = new ArrayList(); // Try several variants List/*<String>*/ glesLibNames = new ArrayList(); + List/*<String>*/ eglLibNames = new ArrayList(); if (GLProfile.isGLES2()) { // Unix @@ -80,25 +91,22 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { } // EGL Unix - glesLibNames.add("libEGL"); + eglLibNames.add("libEGL"); // EGL Windows - glesLibNames.add("EGL"); + eglLibNames.add("EGL"); ClassLoader loader = getClass().getClassLoader(); - for (Iterator iter = glesLibNames.iterator(); iter.hasNext(); ) { - NativeLibrary lib = NativeLibrary.open((String) iter.next(), loader); - if (lib != null) { - libs.add(lib); - break; - } - } - - if (libs.isEmpty()) { + NativeLibrary lib = loadFirstAvailable(glesLibNames, loader); + if (lib == null) { throw new GLException("Unable to dynamically load OpenGL ES library for profile \"" + GLProfile.getProfile() + "\""); } - - glesLibraries = libs; - + glesLibraries.add(lib); + lib = loadFirstAvailable(eglLibNames, loader); + if (lib == null) { + throw new GLException("Unable to dynamically load EGL library for profile \"" + GLProfile.getProfile() + "\""); + } + glesLibraries.add(lib); + if (GLProfile.isGLES2()) { NativeLibLoader.loadES2(); } else if (GLProfile.isGLES1()) { diff --git a/src/classes/javax/media/opengl/GLProfile.java b/src/classes/javax/media/opengl/GLProfile.java index bc9709341..3dda6aff8 100644 --- a/src/classes/javax/media/opengl/GLProfile.java +++ b/src/classes/javax/media/opengl/GLProfile.java @@ -72,7 +72,7 @@ public class GLProfile { } } catch (Throwable e) { System.out.println("Profile: "+profile+" not available."); - System.out.println("\t"+e); + e.printStackTrace(); profile=null; } } @@ -97,7 +97,15 @@ public class GLProfile { setProfile(profiles[i]); } if(null==profile) { - throw new GLException("Profiles "+profiles+" not available"); + StringBuffer msg = new StringBuffer(); + msg.append("["); + for (int i = 0; i < profiles.length; i++) { + if (i > 0) + msg.append(", "); + msg.append(profiles[i]); + } + msg.append("]"); + throw new GLException("Profiles "+msg.toString()+" not available"); } } diff --git a/src/native/jogl/InternalBufferUtils.c b/src/native/jogl/InternalBufferUtils.c index cfda63ede..4b2001a34 100644 --- a/src/native/jogl/InternalBufferUtils.c +++ b/src/native/jogl/InternalBufferUtils.c @@ -39,10 +39,19 @@ #include <jni.h> -#ifdef _MSC_VER - /* This typedef is apparently needed for compilers before VC8 */ - #if _MSC_VER < 1400 - typedef int intptr_t; +#ifdef _WIN32 + #ifdef _MSC_VER + /* This typedef is apparently needed for Microsoft compilers before VC8, + and on Windows CE */ + #if (_MSC_VER < 1400) || defined(UNDER_CE) + #ifdef _WIN64 + typedef long long intptr_t; + #else + typedef int intptr_t; + #endif + #endif + #else + #include <inttypes.h> #endif #else #include <inttypes.h> diff --git a/src/native/newt/WindowsWindow.c b/src/native/newt/WindowsWindow.c index 4b8356b79..6010580a8 100755 --- a/src/native/newt/WindowsWindow.c +++ b/src/native/newt/WindowsWindow.c @@ -34,9 +34,10 @@ #include <windows.h> #include <tchar.h> #include <stdlib.h> -#ifdef UNDER_CE -#include "aygshell.h" -#endif +// NOTE: it looks like SHFullScreen and/or aygshell.dll is not available on the APX 2500 any more +// #ifdef UNDER_CE +// #include "aygshell.h" +// #endif /* This typedef is apparently needed for Microsoft compilers before VC8, and on Windows CE */ @@ -485,19 +486,20 @@ JNIEXPORT jboolean JNICALL Java_com_sun_javafx_newt_windows_WindowsWindow_setFul if (fullscreen) { screenWidth = GetSystemMetrics(SM_CXSCREEN); screenHeight = GetSystemMetrics(SM_CYSCREEN); - /* First, hide all of the shell parts */ - SHFullScreen(win, - SHFS_HIDETASKBAR | SHFS_HIDESIPBUTTON | SHFS_HIDESTARTICON); + // NOTE: looks like SHFullScreen and/or aygshell.dll is not available on the APX 2500 any more + // First, hide all of the shell parts + // SHFullScreen(win, + // SHFS_HIDETASKBAR | SHFS_HIDESIPBUTTON | SHFS_HIDESTARTICON); MoveWindow(win, 0, 0, screenWidth, screenHeight, TRUE); (*env)->CallVoidMethod(env, obj, sizeChangedID, (jint) screenWidth, (jint) screenHeight); } else { RECT rc; int width, height; - /* First, show all of the shell parts */ - SHFullScreen(win, - SHFS_SHOWTASKBAR | SHFS_SHOWSIPBUTTON | SHFS_SHOWSTARTICON); - /* Now resize the window to the size of the work area */ + // First, show all of the shell parts + // SHFullScreen(win, + // SHFS_SHOWTASKBAR | SHFS_SHOWSIPBUTTON | SHFS_SHOWSTARTICON); + // Now resize the window to the size of the work area SystemParametersInfo(SPI_GETWORKAREA, 0, &rc, FALSE); width = rc.right - rc.left; height = rc.bottom - rc.top; |