diff options
author | Sven Gothel <[email protected]> | 2009-03-20 17:13:52 +0000 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2009-03-20 17:13:52 +0000 |
commit | 1351343c7065f0ebbb9a3597c90a740498b2e7eb (patch) | |
tree | 49644e545f7b907277d213ec36d498417ea5945d | |
parent | 4d4a02ebdcd0e194ebd41a3ca1f23a38438095fd (diff) |
Make isGL* methods consistend with the getGL* ones
git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/../svn-server-sync/gluegen/branches/JOGL_2_SANDBOX@130 a78bb65f-1512-4460-ba86-f6dc96a7bf27
-rw-r--r-- | src/java/com/sun/gluegen/opengl/BuildComposablePipeline.java | 35 |
1 files changed, 32 insertions, 3 deletions
diff --git a/src/java/com/sun/gluegen/opengl/BuildComposablePipeline.java b/src/java/com/sun/gluegen/opengl/BuildComposablePipeline.java index deefc55..dcfa682 100644 --- a/src/java/com/sun/gluegen/opengl/BuildComposablePipeline.java +++ b/src/java/com/sun/gluegen/opengl/BuildComposablePipeline.java @@ -176,10 +176,10 @@ public class BuildComposablePipeline for (Iterator iter=publicMethodsRaw.iterator(); iter.hasNext(); ) { Method method = (Method) iter.next(); // Don't hook methods which aren't real GL methods, - // such as the synthetic "getGL2ES2" + // such as the synthetic "isGL2ES2" "getGL2ES2" String name = method.getName(); boolean runHooks = name.startsWith("gl"); - if (!name.startsWith("getGL") && !name.equals("toString")) { + if (!name.startsWith("getGL") && !name.startsWith("isGL") && !name.equals("toString")) { publicMethodsPlain.add(new PlainMethod(method, runHooks)); } } @@ -375,6 +375,7 @@ public class BuildComposablePipeline constructorHook(output); + emitGLIsMethods(output); emitGLGetMethods(output); while (methodsToWrap.hasNext()) @@ -594,6 +595,34 @@ public class BuildComposablePipeline protected abstract void emitClassDocComment(PrintWriter output); /** + * Emits one of the isGL* methods. + */ + protected void emitGLIsMethod(PrintWriter output, String type) { + output.println(" public boolean is" + type + "() {"); + Class clazz = BuildComposablePipeline.getClass("javax.media.opengl." + type); + if (clazz.isAssignableFrom(baseInterfaceClass)) { + output.println(" return true;"); + } else { + output.println(" return false;"); + } + output.println(" }"); + } + + /** + * Emits all of the isGL* methods. + */ + protected void emitGLIsMethods(PrintWriter output) { + emitGLIsMethod(output, "GL"); + emitGLIsMethod(output, "GL2"); + emitGLIsMethod(output, "GLES1"); + emitGLIsMethod(output, "GLES2"); + emitGLIsMethod(output, "GL2ES1"); + emitGLIsMethod(output, "GL2ES2"); + output.println(" public boolean isGLES() {"); + output.println(" return isGLES2() || isGLES1();"); + output.println(" }"); + } + /** * Emits one of the getGL* methods. */ protected void emitGLGetMethod(PrintWriter output, String type) { @@ -710,7 +739,7 @@ public class BuildComposablePipeline output.println(" * "); output.println("<PRE>"); if(null!=prologNameOpt) { - output.println(" drawable.setGL( new "+className+"( drawable.getGL().getGL2ES2(), new "+prologNameOpt+"(drawable.getGL(.getGL2ES2())) ) );"); + output.println(" drawable.setGL( new "+className+"( drawable.getGL().getGL2ES2(), new "+prologNameOpt+"( drawable.getGL().getGL2ES2() ) ) );"); } else { output.println(" drawable.setGL( new "+className+"( drawable.getGL().getGL2ES2() ) );"); } |