aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/classes/com/sun/opengl/impl/GLContextImpl.java8
-rwxr-xr-xsrc/classes/com/sun/opengl/impl/egl/EGLDrawableFactory.java33
2 files changed, 37 insertions, 4 deletions
diff --git a/src/classes/com/sun/opengl/impl/GLContextImpl.java b/src/classes/com/sun/opengl/impl/GLContextImpl.java
index de9f73e6e..20fc6916c 100644
--- a/src/classes/com/sun/opengl/impl/GLContextImpl.java
+++ b/src/classes/com/sun/opengl/impl/GLContextImpl.java
@@ -334,12 +334,15 @@ public abstract class GLContextImpl extends GLContext {
*/
public boolean isFunctionAvailable(String glFunctionName) {
if(isCreated()) {
+ // Check GL 1st (cached)
ProcAddressTable pTable = getGLProcAddressTable();
try {
if(0!=pTable.getAddressFor(glFunctionName)) {
return true;
}
} catch (Exception e) {}
+
+ // Check platform extensions 2nd (cached)
pTable = getPlatformExtProcAddressTable();
try {
if(0!=pTable.getAddressFor(glFunctionName)) {
@@ -347,6 +350,11 @@ public abstract class GLContextImpl extends GLContext {
}
} catch (Exception e) {}
}
+ // dynamic function lookup at last (not cached)
+ GLDrawableFactoryImpl factoryImpl = (GLDrawableFactoryImpl)getGLDrawable().getFactory();
+ if(0!=factoryImpl.dynamicLookupFunction(glFunctionName)) {
+ return true;
+ }
return false;
}
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;
}