aboutsummaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/jogamp/opengl/ExtensionAvailabilityCache.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/jogl/classes/jogamp/opengl/ExtensionAvailabilityCache.java')
-rw-r--r--src/jogl/classes/jogamp/opengl/ExtensionAvailabilityCache.java29
1 files changed, 16 insertions, 13 deletions
diff --git a/src/jogl/classes/jogamp/opengl/ExtensionAvailabilityCache.java b/src/jogl/classes/jogamp/opengl/ExtensionAvailabilityCache.java
index b28b79418..79ceeaf7a 100644
--- a/src/jogl/classes/jogamp/opengl/ExtensionAvailabilityCache.java
+++ b/src/jogl/classes/jogamp/opengl/ExtensionAvailabilityCache.java
@@ -46,7 +46,7 @@ import java.util.StringTokenizer;
import com.jogamp.opengl.GL;
import com.jogamp.opengl.GL2ES3;
import com.jogamp.opengl.GLContext;
-
+import com.jogamp.common.ExceptionUtils;
import com.jogamp.common.util.VersionNumber;
/**
@@ -140,7 +140,7 @@ final class ExtensionAvailabilityCache {
// Use 'glGetStringi' only for ARB GL3 and ES3 context,
// on GL2 platforms the function might be available, but not working.
if ( context.isGL3() || context.isGLES3() ) {
- if ( ! context.isFunctionAvailable("glGetStringi") ) {
+ if ( ! context.has_glGetStringiInt() ) {
if(DEBUG) {
System.err.println("GLContext: GL >= 3.1 usage, but no glGetStringi");
}
@@ -155,23 +155,26 @@ final class ExtensionAvailabilityCache {
}
if(useGetStringi) {
- final GL2ES3 gl2es3 = (GL2ES3)gl; // validated via context - OK!
final int count;
{
final int[] val = { 0 } ;
- gl2es3.glGetIntegerv(GL2ES3.GL_NUM_EXTENSIONS, val, 0);
+ context.glGetIntegervInt(GL2ES3.GL_NUM_EXTENSIONS, val, 0);
count = val[0];
}
final StringBuilder sb = new StringBuilder();
- for (int i = 0; i < count; i++) {
- final String ext = gl2es3.glGetStringi(GL.GL_EXTENSIONS, i);
- if( null == availableExtensionCache.put(ext, ext) ) {
- // new one
- if( 0 < i ) {
- sb.append(" ");
+ try {
+ for (int i = 0; i < count; i++) {
+ final String ext = context.glGetStringiInt(GL.GL_EXTENSIONS, i);
+ if( null == availableExtensionCache.put(ext, ext) ) {
+ // new one
+ if( 0 < i ) {
+ sb.append(" ");
+ }
+ sb.append(ext);
}
- sb.append(ext);
}
+ } catch (final UnsatisfiedLinkError ule) {
+ ExceptionUtils.dumpThrowable("glGetStringi native access", ule);
}
if(0==count || sb.length()==0) {
// fall back ..
@@ -182,7 +185,7 @@ final class ExtensionAvailabilityCache {
}
}
if(!useGetStringi) {
- glExtensions = gl.glGetString(GL.GL_EXTENSIONS);
+ glExtensions = context.glGetStringInt(GL.GL_EXTENSIONS);
if(null != glExtensions) {
final StringTokenizer tok = new StringTokenizer(glExtensions);
int count = 0;
@@ -223,7 +226,7 @@ final class ExtensionAvailabilityCache {
if (DEBUG) {
System.err.println(getThreadName() + ":ExtensionAvailabilityCache: GLX_EXTENSIONS: "+glXExtensionCount);
- System.err.println(getThreadName() + ":ExtensionAvailabilityCache: GL vendor: " + gl.glGetString(GL.GL_VENDOR));
+ System.err.println(getThreadName() + ":ExtensionAvailabilityCache: GL vendor: " + context.glGetStringInt(GL.GL_VENDOR));
System.err.println(getThreadName() + ":ExtensionAvailabilityCache: ALL EXTENSIONS: "+availableExtensionCache.size());
}