aboutsummaryrefslogtreecommitdiffstats
path: root/src/java/com/sun/gluegen
diff options
context:
space:
mode:
authorKenneth Russel <[email protected]>2009-03-19 07:40:23 +0000
committerKenneth Russel <[email protected]>2009-03-19 07:40:23 +0000
commit27074b59502e996f0027638d8ad0cc584cb94da4 (patch)
tree3cbc64737ceabaeed1391cc41fc4e76a952f1814 /src/java/com/sun/gluegen
parenta6d4a61f9c28ef2420f7ff5a136eb6e0a7481059 (diff)
Removed reflective queries from GLProfile and their use in
BuildComposablePipeline's generated code. Stopped squelching exceptions in GlueGen. Fixed error in glxext.cfg. git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/../svn-server-sync/gluegen/branches/JOGL_2_SANDBOX@128 a78bb65f-1512-4460-ba86-f6dc96a7bf27
Diffstat (limited to 'src/java/com/sun/gluegen')
-rw-r--r--src/java/com/sun/gluegen/JavaConfiguration.java4
-rw-r--r--src/java/com/sun/gluegen/opengl/BuildComposablePipeline.java60
2 files changed, 27 insertions, 37 deletions
diff --git a/src/java/com/sun/gluegen/JavaConfiguration.java b/src/java/com/sun/gluegen/JavaConfiguration.java
index d25473a..caecd06 100644
--- a/src/java/com/sun/gluegen/JavaConfiguration.java
+++ b/src/java/com/sun/gluegen/JavaConfiguration.java
@@ -1065,7 +1065,7 @@ public class JavaConfiguration {
javaFile = new File(tok.nextToken());
javaReader = new BufferedReader(new FileReader(javaFile));
} catch (FileNotFoundException e) {
- System.err.println(e);
+ e.printStackTrace();
return;
}
@@ -1078,7 +1078,7 @@ public class JavaConfiguration {
try {
parser.compilationUnit();
} catch (Exception e) {
- System.err.println(e);
+ e.printStackTrace();
return;
}
diff --git a/src/java/com/sun/gluegen/opengl/BuildComposablePipeline.java b/src/java/com/sun/gluegen/opengl/BuildComposablePipeline.java
index 057158a..deefc55 100644
--- a/src/java/com/sun/gluegen/opengl/BuildComposablePipeline.java
+++ b/src/java/com/sun/gluegen/opengl/BuildComposablePipeline.java
@@ -375,7 +375,7 @@ public class BuildComposablePipeline
constructorHook(output);
- output.println(strGLGetMethods);
+ emitGLGetMethods(output);
while (methodsToWrap.hasNext())
{
@@ -593,41 +593,31 @@ public class BuildComposablePipeline
/** Emit a Javadoc comment for this pipeline class. */
protected abstract void emitClassDocComment(PrintWriter output);
- protected final static String strGLGetMethods =
- " public javax.media.opengl.GL getGL() {\n"+
- " return (javax.media.opengl.GL) this;\n"+
- " }\n"+
- " public javax.media.opengl.GL2ES1 getGL2ES1() {\n"+
- " if(GLProfile.implementationOfGL2ES1(this)) {\n"+
- " return (javax.media.opengl.GL2ES1) this;\n"+
- " }\n"+
- " throw new GLException(\"Not a GL2ES1 implementation\");\n"+
- " }\n"+
- " public javax.media.opengl.GL2 getGL2() {\n"+
- " if(GLProfile.implementationOfGL2(this)) {\n"+
- " return (javax.media.opengl.GL2) this;\n"+
- " }\n"+
- " throw new GLException(\"Not a GL2 implementation\");\n"+
- " }\n"+
- " public javax.media.opengl.GL2ES2 getGL2ES2() {\n"+
- " if(GLProfile.implementationOfGL2ES2(this)) {\n"+
- " return (javax.media.opengl.GL2ES2) this;\n"+
- " }\n"+
- " throw new GLException(\"Not a GL2ES2 implementation\");\n"+
- " }\n"+
- " public javax.media.opengl.GLES1 getGLES1() {\n"+
- " if(GLProfile.implementationOfGLES1(this)) {\n"+
- " return (javax.media.opengl.GLES1) this;\n"+
- " }\n"+
- " throw new GLException(\"Not a GLES1 implementation\");\n"+
- " }\n"+
- " public javax.media.opengl.GLES2 getGLES2() {\n"+
- " if(GLProfile.implementationOfGLES2(this)) {\n"+
- " return (javax.media.opengl.GLES2) this;\n"+
- " }\n"+
- " throw new GLException(\"Not a GLES2 implementation\");\n"+
- " }";
+ /**
+ * Emits one of the getGL* methods.
+ */
+ protected void emitGLGetMethod(PrintWriter output, String type) {
+ output.println(" public javax.media.opengl." + type + " get" + type + "() {");
+ Class clazz = BuildComposablePipeline.getClass("javax.media.opengl." + type);
+ if (clazz.isAssignableFrom(baseInterfaceClass)) {
+ output.println(" return this;");
+ } else {
+ output.println(" throw new GLException(\"Not a " + type + " implementation\");");
+ }
+ output.println(" }");
+ }
+ /**
+ * Emits all of the getGL* methods.
+ */
+ protected void emitGLGetMethods(PrintWriter output) {
+ emitGLGetMethod(output, "GL");
+ emitGLGetMethod(output, "GL2");
+ emitGLGetMethod(output, "GLES1");
+ emitGLGetMethod(output, "GLES2");
+ emitGLGetMethod(output, "GL2ES1");
+ emitGLGetMethod(output, "GL2ES2");
+ }
} // end class PipelineEmitter
//-------------------------------------------------------