aboutsummaryrefslogtreecommitdiffstats
path: root/src/classes/com/sun/opengl/impl/egl/EGLDrawableFactory.java
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2008-11-14 05:08:29 +0000
committerSven Gothel <[email protected]>2008-11-14 05:08:29 +0000
commit774cd9d1685bd3f4dbb19ed06b57c6d11f118e1e (patch)
treee3336358437169db6527f26f11e3651c353c6478 /src/classes/com/sun/opengl/impl/egl/EGLDrawableFactory.java
parent0ecb8836363584542c5bfdd27bae5e1ecde7bd0f (diff)
- EGL
- Adding 'eglGetProcAddress(long eglGetProcAddressHandle, String funcName)', to be able to bootstrap 'eglGetProcAddress'. - EGLDrawableFactory - Adding ES2 libname GLES20 - Adding dynamicLookupFunctionOnLibs: Lookup in the libraries (dlsym) - Change dynamicLookupFunction: - Bootstrap 'eglGetProcAddress' first - 1st try eglGetProcAddress - 2nd try dynamicLookupFunctionOnLibs - GLContextImpl.isFunctionAvailable() - 1st try GL proc table (cached) - 2nd try platform extension proc table (cached) - 3rd try EGLDrawableFactory.dynamicLookupFunction (not cached) git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/svn-server-sync/jogl/branches/JOGL_2_SANDBOX@1787 232f8b59-042b-4e1e-8c03-345bb8c30851
Diffstat (limited to 'src/classes/com/sun/opengl/impl/egl/EGLDrawableFactory.java')
-rwxr-xr-xsrc/classes/com/sun/opengl/impl/egl/EGLDrawableFactory.java33
1 files changed, 29 insertions, 4 deletions
diff --git a/src/classes/com/sun/opengl/impl/egl/EGLDrawableFactory.java b/src/classes/com/sun/opengl/impl/egl/EGLDrawableFactory.java
index b7c62bfd0..ed045939b 100755
--- a/src/classes/com/sun/opengl/impl/egl/EGLDrawableFactory.java
+++ b/src/classes/com/sun/opengl/impl/egl/EGLDrawableFactory.java
@@ -71,9 +71,11 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl {
if (GLProfile.isGLES2()) {
// Unix
+ glesLibNames.add("libGLES20");
glesLibNames.add("libGLESv2");
glesLibNames.add("libGLESv2_CM");
// Windows
+ glesLibNames.add("GLES20");
glesLibNames.add("GLESv2");
glesLibNames.add("GLESv2_CM");
} else if (GLProfile.isGLES1()) {
@@ -161,11 +163,8 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl {
public void loadGLULibrary() {
}
- public long dynamicLookupFunction(String glFuncName) {
+ private long dynamicLookupFunctionOnLibs(String glFuncName) {
// Look up this function name in all known libraries
- //
- // Note that we aren't using eglGetProcAddress; maybe we
- // should once it's bootstrapped (FIXME)
for (Iterator iter = glesLibraries.iterator(); iter.hasNext(); ) {
NativeLibrary lib = (NativeLibrary) iter.next();
long addr = lib.lookupFunction(glFuncName);
@@ -177,6 +176,32 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl {
return 0;
}
+ private long eglGetProcAddressHandle = 0;
+
+ public long dynamicLookupFunction(String glFuncName) {
+ if(null==glFuncName) {
+ return 0;
+ }
+
+ // bootstrap eglGetProcAddress
+ if(0==eglGetProcAddressHandle) {
+ eglGetProcAddressHandle = dynamicLookupFunctionOnLibs("eglGetProcAddress");
+ if(0==eglGetProcAddressHandle) {
+ throw new GLException("Couldn't find eglGetProcAddress function entry");
+ }
+ }
+
+ if(glFuncName.equals("eglGetProcAddress")) {
+ return eglGetProcAddressHandle;
+ }
+
+ long addr = EGL.eglGetProcAddress(eglGetProcAddressHandle, glFuncName);
+ if(0==addr) {
+ addr = dynamicLookupFunctionOnLibs(glFuncName);
+ }
+ return addr;
+ }
+
public boolean canCreateContextOnJava2DSurface() {
return false;
}