aboutsummaryrefslogtreecommitdiffstats
path: root/src/classes
diff options
context:
space:
mode:
Diffstat (limited to 'src/classes')
-rw-r--r--src/classes/com/sun/opengl/impl/GLContextImpl.java17
-rw-r--r--src/classes/com/sun/opengl/impl/GLReflection.java4
-rw-r--r--src/classes/com/sun/opengl/impl/NativeLibLoader.java9
-rw-r--r--src/classes/javax/media/opengl/GLDrawableFactory.java4
-rw-r--r--src/classes/javax/media/opengl/GLProfile.java51
5 files changed, 57 insertions, 28 deletions
diff --git a/src/classes/com/sun/opengl/impl/GLContextImpl.java b/src/classes/com/sun/opengl/impl/GLContextImpl.java
index 5a4cd82fd..75b24c0af 100644
--- a/src/classes/com/sun/opengl/impl/GLContextImpl.java
+++ b/src/classes/com/sun/opengl/impl/GLContextImpl.java
@@ -229,22 +229,7 @@ public abstract class GLContextImpl extends GLContext {
//
private Object createInstance(String suffix, Class[] cstrArgTypes, Object[] cstrArgs) {
- String clazzName = null;
-
- try {
- if(GLProfile.isGL2()) {
- clazzName="com.sun.opengl.impl.gl2.GL2"+suffix;
- } else if(GLProfile.isGLES1()) {
- clazzName="com.sun.opengl.impl.es1.GLES1"+suffix;
- } else if(GLProfile.isGLES1()) {
- clazzName="com.sun.opengl.impl.es2.GLES2"+suffix;
- } else {
- throw new GLUnsupportedException("uncovered profile");
- }
- return GLReflection.createInstance(clazzName, cstrArgTypes, cstrArgs);
- } catch (Exception e) {
- throw new GLException(e);
- }
+ return GLReflection.createInstance(GLProfile.getGLImplBaseClassName()+suffix, cstrArgTypes, cstrArgs);
}
/** Create the GL for this context. */
diff --git a/src/classes/com/sun/opengl/impl/GLReflection.java b/src/classes/com/sun/opengl/impl/GLReflection.java
index bbcb7c8ea..256a9b9af 100644
--- a/src/classes/com/sun/opengl/impl/GLReflection.java
+++ b/src/classes/com/sun/opengl/impl/GLReflection.java
@@ -44,9 +44,7 @@ public final class GLReflection {
public static final boolean isClassAvailable(String clazzName) {
try {
Class clazz = Class.forName(clazzName);
- if (null!=clazz) {
- return true;
- }
+ return null!=clazz;
} catch (Exception e) { }
return false;
}
diff --git a/src/classes/com/sun/opengl/impl/NativeLibLoader.java b/src/classes/com/sun/opengl/impl/NativeLibLoader.java
index 6a1270ac2..6327c17d2 100644
--- a/src/classes/com/sun/opengl/impl/NativeLibLoader.java
+++ b/src/classes/com/sun/opengl/impl/NativeLibLoader.java
@@ -124,6 +124,15 @@ public class NativeLibLoader {
});
}
+ public static void loadGL2ES12() {
+ AccessController.doPrivileged(new PrivilegedAction() {
+ public Object run() {
+ loadLibrary("jogl_gl2es12", null, false, false);
+ return null;
+ }
+ });
+ }
+
public static void loadES2() {
AccessController.doPrivileged(new PrivilegedAction() {
public Object run() {
diff --git a/src/classes/javax/media/opengl/GLDrawableFactory.java b/src/classes/javax/media/opengl/GLDrawableFactory.java
index a6e382760..e28c9b28e 100644
--- a/src/classes/javax/media/opengl/GLDrawableFactory.java
+++ b/src/classes/javax/media/opengl/GLDrawableFactory.java
@@ -95,7 +95,7 @@ public abstract class GLDrawableFactory {
} catch (Exception e) {
e.printStackTrace();
}
- } else if (!GLProfile.isGL2()) {
+ } else if (!GLProfile.isGL2() && !GLProfile.isGL2ES12()) {
// We require that the user passes in one of the known profiles
throw new GLException("Unknown or unsupported profile \"" + GLProfile.getProfile() + "\"");
}
@@ -162,7 +162,7 @@ public abstract class GLDrawableFactory {
} catch (Exception e) {
e.printStackTrace();
}
- } else if (!GLProfile.isGL2()) {
+ } else if (!GLProfile.isGL2() && !GLProfile.isGL2ES12()) {
// We require that the user passes in one of the known profiles
throw new GLException("Unknown or unsupported profile \"" + GLProfile.getProfile() + "\"");
}
diff --git a/src/classes/javax/media/opengl/GLProfile.java b/src/classes/javax/media/opengl/GLProfile.java
index 21dccc8ed..d4c8d4c6b 100644
--- a/src/classes/javax/media/opengl/GLProfile.java
+++ b/src/classes/javax/media/opengl/GLProfile.java
@@ -44,6 +44,9 @@ public class GLProfile {
/** The desktop (OpenGL 2.0) profile */
public static final String GL2 = "GL2";
+ /** The desktop short profile, intersecting: GL2+GLES1+GLES2 */
+ public static final String GL2ES12 = "GL2ES12";
+
/** The OpenGL ES 1 (really, 1.1) profile */
public static final String GLES1 = "GLES1";
@@ -56,8 +59,11 @@ public class GLProfile {
private static final void tryLibrary()
{
try {
+ Class clazz = Class.forName(getGLImplBaseClassName()+"Impl");
if(GL2.equals(profile)) {
NativeLibLoader.loadGL2();
+ } if(GL2ES12.equals(profile)) {
+ NativeLibLoader.loadGL2ES12();
} else if(GLES1.equals(profile) || GLES2.equals(profile)) {
Object eGLDrawableFactory = GLReflection.createInstance("com.sun.opengl.impl.egl.EGLDrawableFactory");
if(null==eGLDrawableFactory) {
@@ -95,15 +101,21 @@ public class GLProfile {
}
}
+ /**
+ * Selects a profile, implementing the interface GL2ES1.
+ */
public static synchronized final void setProfileGL2ES1() {
- setProfile(new String[] { GLES1, GL2 });
+ setProfile(new String[] { GLES1, GL2ES12, GL2 });
if(null==profile) {
throw new GLException("Profiles GLES1 and GL2 not available");
}
}
+ /**
+ * Selects a profile, implementing the interface GL2ES2.
+ */
public static synchronized final void setProfileGL2ES2() {
- setProfile(new String[] { GLES2, GL2 });
+ setProfile(new String[] { GLES2, GL2ES12, GL2 });
if(null==profile) {
throw new GLException("Profiles GLES2 and GL2 not available");
}
@@ -113,26 +125,37 @@ public class GLProfile {
return profile;
}
+ /* true profile GL2ES12 */
+ public static final boolean isGL2ES12() {
+ return GL2ES12.equals(profile);
+ }
+
+ /* true profile GL2 */
public static final boolean isGL2() {
return GL2.equals(profile);
}
+ /* true profile GLES1 */
public static final boolean isGLES1() {
return GLES1.equals(profile);
}
- public static final boolean isGL2ES1() {
- return isGL2() || isGLES1();
- }
-
+ /* true profile GLES2 */
public static final boolean isGLES2() {
return GLES2.equals(profile);
}
+ /* abstract profile GL2ES12, GL2, GLES1 */
+ public static final boolean isGL2ES1() {
+ return isGL2ES12() || isGL2() || isGLES1();
+ }
+
+ /* abstract profile GL2ES12, GL2, GLES2 */
public static final boolean isGL2ES2() {
- return isGL2() || isGLES2();
+ return isGL2ES12() || isGL2() || isGLES2();
}
+ /* abstract profile GLES1, GLES2 */
public static final boolean isGLES() {
return isGLES2() || isGLES1();
}
@@ -165,5 +188,19 @@ public class GLProfile {
return GLReflection.implementationOf(obj, "javax.media.opengl.GL2ES2");
}
+ public static final String getGLImplBaseClassName() {
+ if(isGL2()) {
+ return "com.sun.opengl.impl.gl2.GL2";
+ } else if(isGL2ES12()) {
+ return "com.sun.opengl.impl.gl2es12.GL2ES12";
+ } else if(isGLES1()) {
+ return "com.sun.opengl.impl.es1.GLES1";
+ } else if(isGLES2()) {
+ return "com.sun.opengl.impl.es2.GLES2";
+ } else {
+ throw new GLUnsupportedException("uncovered profile");
+ }
+ }
+
}