aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--make/config/jogl/gl-gl2es12.cfg37
-rw-r--r--make/config/jogl/gl-impl-CustomJavaCode-gl2_es2.java22
-rw-r--r--make/config/jogl/gl-impl-CustomJavaCode-gl2es12.java17
-rwxr-xr-xmake/config/jogl/glu-CustomJavaCode-base.java2
-rw-r--r--src/jogl/classes/javax/media/opengl/GLDrawableFactory.java2
-rw-r--r--src/jogl/classes/javax/media/opengl/GLProfile.java79
6 files changed, 91 insertions, 68 deletions
diff --git a/make/config/jogl/gl-gl2es12.cfg b/make/config/jogl/gl-gl2es12.cfg
index 6d1b34bcf..74103066a 100644
--- a/make/config/jogl/gl-gl2es12.cfg
+++ b/make/config/jogl/gl-gl2es12.cfg
@@ -2,24 +2,15 @@
JavaOutputDir gensrc/classes
NativeOutputDir gensrc/native/jogl/gl2es12
-ExtendedInterfaceSymbolsOnly ../build-temp/gensrc/classes/javax/media/opengl/GL.java
-ExtendedInterfaceSymbolsOnly ../build-temp/gensrc/classes/javax/media/opengl/GL2ES1.java
-ExtendedInterfaceSymbolsOnly ../build-temp/gensrc/classes/javax/media/opengl/GL2ES2.java
-ExtendedInterfaceSymbolsOnly ../src/jogl/classes/javax/media/opengl/GLBase.java
-ExtendedInterfaceSymbolsOnly ../src/jogl/classes/javax/media/opengl/fixedfunc/GLMatrixFunc.java
-ExtendedInterfaceSymbolsOnly ../src/jogl/classes/javax/media/opengl/fixedfunc/GLPointerFunc.java
-ExtendedInterfaceSymbolsOnly ../src/jogl/classes/javax/media/opengl/fixedfunc/GLLightingFunc.java
-
-Package javax.media.opengl
-Style InterfaceAndImpl
-JavaClass GL2ES12
-Extends GL2ES12 GL
-Extends GL2ES12 GL2ES1
-Extends GL2ES12 GL2ES2
-Extends GL2ES12 GLBase
-Extends GL2ES12 GLMatrixFunc
-Extends GL2ES12 GLPointerFunc
-Extends GL2ES12 GLLightingFunc
+ExtendedInterfaceSymbols ../build-temp/gensrc/classes/javax/media/opengl/GL.java
+ExtendedInterfaceSymbols ../build-temp/gensrc/classes/javax/media/opengl/GL2ES1.java
+ExtendedInterfaceSymbols ../build-temp/gensrc/classes/javax/media/opengl/GL2ES2.java
+ExtendedInterfaceSymbols ../src/jogl/classes/javax/media/opengl/GLBase.java
+ExtendedInterfaceSymbols ../src/jogl/classes/javax/media/opengl/fixedfunc/GLMatrixFunc.java
+ExtendedInterfaceSymbols ../src/jogl/classes/javax/media/opengl/fixedfunc/GLPointerFunc.java
+ExtendedInterfaceSymbols ../src/jogl/classes/javax/media/opengl/fixedfunc/GLLightingFunc.java
+
+Style ImplOnly
ImplPackage com.sun.opengl.impl.gl2es12
ImplJavaClass GL2ES12Impl
Implements GL2ES12Impl GL
@@ -34,6 +25,11 @@ Include gl-common-gl2.cfg
Include gl-common-extensions.cfg
Include gl-desktop.cfg
+# Because we're manually implementing glMapBuffer but only producing
+# the implementing class, GlueGen doesn't notice that it has to emit a
+# proc address table entry for it. Force it to here.
+ForceProcAddressGen glMapBuffer
+
EmitProcAddressTable true
ProcAddressTableClassName GL2ES12ProcAddressTable
GetProcAddressTableExpr ((GL2ES12ProcAddressTable)_context.getGLProcAddressTable())
@@ -41,10 +37,6 @@ GetProcAddressTableExpr ((GL2ES12ProcAddressTable)_context.getGLProcAddressTable
# Pick up on-line OpenGL javadoc thanks to user cylab on javagaming.org forums
TagNativeBinding true
-CustomJavaCode GL2ES12 public static final int GL_STENCIL_INDEX16 = 0x8D49;
-CustomJavaCode GL2ES12 public static final int GL_RGBA_FLOAT32_APPLE = 0x8814;
-CustomJavaCode GL2ES12 public static final int GL_RGBA_FLOAT16_APPLE = 0x881A;
-
CustomJavaCode GL2ES12Impl public void glFrustumf(float left, float right, float bottom, float top, float zNear, float zFar) {
CustomJavaCode GL2ES12Impl glFrustum((double)left, (double)right, (double)bottom, (double)top, (double)zNear, (double)zFar); }
@@ -67,6 +59,5 @@ IncludeAs CustomCCode gl-impl-CustomCCode-gl2es12.c
Import javax.media.opengl.GLES1
Import javax.media.opengl.GLES2
-Import javax.media.opengl.GL2ES12
Import com.sun.opengl.impl.InternalBufferUtil
Import java.io.PrintStream
diff --git a/make/config/jogl/gl-impl-CustomJavaCode-gl2_es2.java b/make/config/jogl/gl-impl-CustomJavaCode-gl2_es2.java
index 0575eb1a2..37b19ec8a 100644
--- a/make/config/jogl/gl-impl-CustomJavaCode-gl2_es2.java
+++ b/make/config/jogl/gl-impl-CustomJavaCode-gl2_es2.java
@@ -295,17 +295,19 @@
public final String toString() {
StringBuffer buf = new StringBuffer();
buf.append(getClass().getName());
- buf.append(" [GLSL compiler: ");
- buf.append(glShaderCompilerAvailable());
- Set bfs = glGetShaderBinaryFormats();
- buf.append(", binary formats ");
- buf.append(bfs.size());
- buf.append(":");
- for(Iterator iter=bfs.iterator(); iter.hasNext(); ) {
- buf.append(" ");
- buf.append(((Integer)(iter.next())).intValue());
+ if (isGL2ES2()) {
+ buf.append(" [GLSL compiler: ");
+ buf.append(glShaderCompilerAvailable());
+ Set bfs = glGetShaderBinaryFormats();
+ buf.append(", binary formats ");
+ buf.append(bfs.size());
+ buf.append(":");
+ for(Iterator iter=bfs.iterator(); iter.hasNext(); ) {
+ buf.append(" ");
+ buf.append(((Integer)(iter.next())).intValue());
+ }
+ buf.append("]");
}
- buf.append("]");
return buf.toString();
}
diff --git a/make/config/jogl/gl-impl-CustomJavaCode-gl2es12.java b/make/config/jogl/gl-impl-CustomJavaCode-gl2es12.java
index 4668bd7ff..560124a99 100644
--- a/make/config/jogl/gl-impl-CustomJavaCode-gl2es12.java
+++ b/make/config/jogl/gl-impl-CustomJavaCode-gl2es12.java
@@ -18,8 +18,11 @@ public void setObjectTracker(GLObjectTracker tracker) {
public GL2ES12Impl(GLContextImpl context) {
this._context = context;
this.bufferSizeTracker = context.getBufferSizeTracker();
+ this.isGL2ES2 = GLProfile.isGL2ES2();
}
+private boolean isGL2ES2;
+
public final boolean isGL() {
return false;
}
@@ -41,11 +44,11 @@ public final boolean isGLES() {
}
public final boolean isGL2ES1() {
- return true;
+ return !isGL2ES2;
}
public final boolean isGL2ES2() {
- return true;
+ return isGL2ES2;
}
public final GL getGL() throws GLException {
@@ -65,11 +68,17 @@ public final GLES2 getGLES2() throws GLException {
}
public final GL2ES1 getGL2ES1() throws GLException {
- return this;
+ if (isGL2ES1()) {
+ return this;
+ }
+ throw new GLException("Not a GL2ES1 implementation");
}
public final GL2ES2 getGL2ES2() throws GLException {
- return this;
+ if (isGL2ES2()) {
+ return this;
+ }
+ throw new GLException("Not a GL2ES2 implementation");
}
public boolean isFunctionAvailable(String glFunctionName) {
diff --git a/make/config/jogl/glu-CustomJavaCode-base.java b/make/config/jogl/glu-CustomJavaCode-base.java
index 94a859ba5..5b8a30f46 100755
--- a/make/config/jogl/glu-CustomJavaCode-base.java
+++ b/make/config/jogl/glu-CustomJavaCode-base.java
@@ -93,7 +93,7 @@ public static final GLU createGLU(String profile) throws GLException {
}
} catch (GLException e) { e.printStackTrace(); }
try {
- if(GLProfile.GL2ES12.equals(profile) || GLProfile.GL2.equals(profile) || GLProfile.GLES1.equals(profile)) {
+ if(GLProfile.GL2ES1.equals(profile) || GLProfile.GL2.equals(profile) || GLProfile.GLES1.equals(profile)) {
return (GLU) NWReflection.createInstance("javax.media.opengl.glu.gl2es1.GLUgl2es1");
}
} catch (GLException e) { e.printStackTrace(); }
diff --git a/src/jogl/classes/javax/media/opengl/GLDrawableFactory.java b/src/jogl/classes/javax/media/opengl/GLDrawableFactory.java
index 66585eb56..5a3f9f4e9 100644
--- a/src/jogl/classes/javax/media/opengl/GLDrawableFactory.java
+++ b/src/jogl/classes/javax/media/opengl/GLDrawableFactory.java
@@ -104,7 +104,7 @@ public abstract class GLDrawableFactory {
} catch (Exception e) {
e.printStackTrace();
}
- } else if (!GLProfile.isGL2() && !GLProfile.isGL2ES12()) {
+ } else if (!GLProfile.isGL2() && !GLProfile.isGL2ES1() && !GLProfile.isGL2ES2()) {
// 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/jogl/classes/javax/media/opengl/GLProfile.java b/src/jogl/classes/javax/media/opengl/GLProfile.java
index 625099e16..1ac09c12e 100644
--- a/src/jogl/classes/javax/media/opengl/GLProfile.java
+++ b/src/jogl/classes/javax/media/opengl/GLProfile.java
@@ -43,36 +43,55 @@ import com.sun.opengl.impl.*;
import com.sun.nativewindow.impl.NWReflection;
public class GLProfile {
+ //
+ // Public (user-visible) profiles
+ //
+
/** 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";
/** The OpenGL ES 2 (really, 2.0) profile */
public static final String GLES2 = "GLES2";
+ /** The intersection of the desktop (OpenGL 2.0) and OpenGL ES 1.x profiles */
+ public static final String GL2ES1 = "GL2ES1";
+
+ /** The intersection of the desktop (OpenGL 2.0) and OpenGL ES 2.x profiles */
+ public static final String GL2ES2 = "GL2ES2";
+
+ //
+ // Profiles which are implementation details
+ //
+
+ // The intersection between desktop OpenGL and the union of the OpenGL ES profiles
+ // This is here only to avoid having separate GL2ES1Impl and GL2ES2Impl classes
+ private static final String GL2ES12 = "GL2ES12";
+
/** The JVM/process wide chosen GL profile **/
private static String profile = null;
+ /** The "real" profile implementing the chosen profile; for example,
+ both GL2ES1 and GL2ES2 currently map to GL2ES12 */
+ private static String realProfile = null;
+
private static final Throwable tryLibrary()
{
try {
Class clazz = Class.forName(getGLImplBaseClassName()+"Impl");
- if(GL2.equals(profile)) {
+ if(GL2.equals(realProfile)) {
// See DRIHack.java for an explanation of why this is necessary
DRIHack.begin();
NativeLibLoader.loadGL2();
DRIHack.end();
- } if(GL2ES12.equals(profile)) {
+ } if(GL2ES12.equals(realProfile)) {
// See DRIHack.java for an explanation of why this is necessary
DRIHack.begin();
NativeLibLoader.loadGL2ES12();
DRIHack.end();
- } else if(GLES1.equals(profile) || GLES2.equals(profile)) {
+ } else if(GLES1.equals(realProfile) || GLES2.equals(realProfile)) {
Object eGLDrawableFactory = NWReflection.createInstance("com.sun.opengl.impl.egl.EGLDrawableFactory");
if(null==eGLDrawableFactory) {
throw new GLException("com.sun.opengl.impl.egl.EGLDrawableFactory not available");
@@ -85,22 +104,33 @@ public class GLProfile {
e.printStackTrace();
}
profile=null;
+ realProfile = null;
return e;
}
}
+ private static void computeRealProfile() {
+ if (GL2ES1.equals(profile) ||
+ GL2ES2.equals(profile)) {
+ realProfile = GL2ES12;
+ } else {
+ realProfile = profile;
+ }
+ }
+
public static synchronized final void setProfile(String profile)
throws GLException
{
if(null==GLProfile.profile) {
GLProfile.profile = profile;
+ computeRealProfile();
Throwable t = tryLibrary();
if (GLProfile.profile == null) {
throw new GLException("Profile " + profile + " not available", t);
}
} else {
if(!GLProfile.profile.equals(profile)) {
- throw new GLException("Chosen profile ("+profile+") doesn't match preset one: "+GLProfile.profile);
+ throw new GLException("Requested profile ("+profile+") doesn't match already chosen one: "+GLProfile.profile);
}
}
}
@@ -111,6 +141,7 @@ public class GLProfile {
Throwable t = null;
for(int i=0; profile==null && i<profiles.length; i++) {
profile = profiles[i];
+ computeRealProfile();
if (t == null) {
t = tryLibrary();
} else {
@@ -132,63 +163,53 @@ public class GLProfile {
/**
* Selects a profile, implementing the interface GL2ES1.
- * Order: GL2, GL2ES12, GLES1
+ * Order: GL2ES1, GL2, GLES1
*/
public static synchronized final void setProfileGL2ES1() {
- setProfile(new String[] { GL2, GL2ES12, GLES1 });
+ setProfile(new String[] { GL2ES1, GL2, GLES1 });
}
/**
* Selects a profile, implementing the interface GL2ES2.
- * Order: GL2, GL2ES12, GLES2
+ * Order: GL2ES2, GL2, GLES2
*/
public static synchronized final void setProfileGL2ES2() {
- setProfile(new String[] { GL2, GL2ES12, GLES2 });
+ setProfile(new String[] { GL2ES2, GL2, GLES2 });
}
/**
* Selects a profile, implementing the interface GL
- * Order: GL2, GL2ES12, GLES2, GLES1
+ * Order: GL2, GL2ES2, GL2ES1, GLES2, GLES1
*/
public static synchronized final void setProfileGLAny() {
- setProfile(new String[] { GL2, GL2ES12, GLES2, GLES1 });
+ setProfile(new String[] { GL2, GL2ES2, GL2ES1, GLES2, GLES1 });
}
public static final String getProfile() {
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);
}
- /* 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();
+ return GL2ES1.equals(profile);
}
- /* abstract profile GL2ES12, GL2, GLES2 */
public static final boolean isGL2ES2() {
- return isGL2ES12() || isGL2() || isGLES2();
+ return GL2ES2.equals(profile);
}
- /* abstract profile GLES1, GLES2 */
+ /** Indicates whether either of the OpenGL ES profiles are in use. */
public static final boolean isGLES() {
return isGLES2() || isGLES1();
}
@@ -200,7 +221,7 @@ public class GLProfile {
public static final String getGLImplBaseClassName() {
if(isGL2()) {
return "com.sun.opengl.impl.gl2.GL2";
- } else if(isGL2ES12()) {
+ } else if(isGL2ES1() || isGL2ES2()) {
return "com.sun.opengl.impl.gl2es12.GL2ES12";
} else if(isGLES1()) {
return "com.sun.opengl.impl.es1.GLES1";
@@ -277,7 +298,7 @@ public class GLProfile {
case javax.media.opengl.GL2.GL_2_BYTES:
case javax.media.opengl.GL2.GL_3_BYTES:
case javax.media.opengl.GL2.GL_4_BYTES:
- if( isGL2ES12() || isGL2() ) {
+ if( isGL2() ) {
return true;
}
}
@@ -403,7 +424,7 @@ public class GLProfile {
}
return false;
}
- } else if(GLProfile.isGL2ES12() || GLProfile.isGL2()) {
+ } else if(GLProfile.isGL2ES2() || GLProfile.isGL2()) {
if(isVertexAttribPointer) {
switch(type) {
case GL.GL_UNSIGNED_BYTE: