From 1351343c7065f0ebbb9a3597c90a740498b2e7eb Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Fri, 20 Mar 2009 17:13:52 +0000 Subject: 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 --- .../gluegen/opengl/BuildComposablePipeline.java | 35 ++++++++++++++++++++-- 1 file changed, 32 insertions(+), 3 deletions(-) (limited to 'src') 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()) @@ -593,6 +594,34 @@ public class BuildComposablePipeline /** Emit a Javadoc comment for this pipeline class. */ 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. */ @@ -710,7 +739,7 @@ public class BuildComposablePipeline output.println(" * "); output.println("
");
       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() ) );");
       }
-- 
cgit v1.2.3