From 6136457f10d020c779adc78641d0048f77ab1635 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Mon, 15 Jul 2013 22:49:47 +0200 Subject: Fix BuildComposablePipeline's isGL*/getGL* ; GLBase: getDownstreamGL()/getRootGL(); GLContext.isGL* added proper API doc., isGL3core()/hasNoDefaultVAO() and getDefaultVAO(). - Fix BuildComposablePipeline's isGL*/getGL* (regression of commit 3a0d7703da32e9a5ddf08a334f18588a78038d880) - GLBase: getDownstreamGL()/getRootGL() Allows user traversing through pipelined GL instances. Also added getRootGL() to GLContext. - GLContext.isGL* added proper API doc.: We test the actual context, not the profile. - GLContext isGL3core()/hasNoDefaultVAO() and getDefaultVAO() - Move isGL3code() def. back to pre 3a0d7703da32e9a5ddf08a334f18588a78038d880, i.e. Includes [ GL4, GL3 ] w/o GLES3. - Added hasNoDefaultVAO() and getDefaultVAO() .. incl. [ GL4, GL3, GLES3 ] --- .../gluegen/opengl/BuildComposablePipeline.java | 49 ++++++++++++++++------ 1 file changed, 36 insertions(+), 13 deletions(-) (limited to 'src/jogl/classes/com/jogamp/gluegen') diff --git a/src/jogl/classes/com/jogamp/gluegen/opengl/BuildComposablePipeline.java b/src/jogl/classes/com/jogamp/gluegen/opengl/BuildComposablePipeline.java index b9096df3c..0bd3086c8 100644 --- a/src/jogl/classes/com/jogamp/gluegen/opengl/BuildComposablePipeline.java +++ b/src/jogl/classes/com/jogamp/gluegen/opengl/BuildComposablePipeline.java @@ -167,16 +167,16 @@ public class BuildComposablePipeline { */ public void emit() throws IOException { - List publicMethodsRaw = Arrays.asList(classToComposeAround.getMethods()); + final List publicMethodsRaw = Arrays.asList(classToComposeAround.getMethods()); - Set publicMethodsPlain = new HashSet(); + final Set publicMethodsPlain = new HashSet(); for (Iterator iter = publicMethodsRaw.iterator(); iter.hasNext();) { - Method method = iter.next(); + final Method method = iter.next(); // Don't hook methods which aren't real GL methods, // such as the synthetic "isGL2ES2" "getGL2ES2" - String name = method.getName(); + final String name = method.getName(); boolean runHooks = name.startsWith("gl"); - if (!name.startsWith("getGL") && !name.startsWith("isGL") && !name.equals("toString")) { + if ( !name.startsWith("getGL") && !name.startsWith("isGL") && !name.equals("getDownstreamGL") && !name.equals("toString") ) { publicMethodsPlain.add(new PlainMethod(method, runHooks)); } } @@ -603,8 +603,13 @@ public class BuildComposablePipeline { */ protected void emitGLIsMethod(PrintWriter output, String type) { output.println(" @Override"); - output.println(" public boolean is" + type + "() {"); - output.println(" return " + getDownstreamObjectName() + ".is" + type + "();"); + output.println(" public final boolean is" + type + "() {"); + final Class clazz = BuildComposablePipeline.getClass("javax.media.opengl." + type); + if (clazz.isAssignableFrom(baseInterfaceClass)) { + output.println(" return true;"); + } else { + output.println(" return false;"); + } output.println(" }"); } @@ -626,9 +631,18 @@ public class BuildComposablePipeline { emitGLIsMethod(output, "GL3ES3"); emitGLIsMethod(output, "GL4ES3"); emitGLIsMethod(output, "GL2GL3"); - emitGLIsMethod(output, "GLES"); - emitGLIsMethod(output, "GLES2Compatible"); - emitGLIsMethod(output, "GLES3Compatible"); + output.println(" @Override"); + output.println(" public final boolean isGLES() {"); + output.println(" return isGLES2() || isGLES1();"); + output.println(" }"); + output.println(" @Override"); + output.println(" public final boolean isGLES2Compatible() {"); + output.println(" return " + getDownstreamObjectName() + ".isGLES2Compatible();"); + output.println(" }"); + output.println(" @Override"); + output.println(" public final boolean isGLES3Compatible() {"); + output.println(" return " + getDownstreamObjectName() + ".isGLES3Compatible();"); + output.println(" }"); } /** @@ -636,8 +650,13 @@ public class BuildComposablePipeline { */ protected void emitGLGetMethod(PrintWriter output, String type) { output.println(" @Override"); - output.println(" public javax.media.opengl." + type + " get" + type + "() {"); - output.println(" return " + getDownstreamObjectName() + ".get" + type + "();"); + output.println(" public final javax.media.opengl." + type + " get" + type + "() {"); + final 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(" }"); } @@ -660,7 +679,11 @@ public class BuildComposablePipeline { emitGLGetMethod(output, "GL4ES3"); emitGLGetMethod(output, "GL2GL3"); output.println(" @Override"); - output.println(" public GLProfile getGLProfile() {"); + output.println(" public final GL getDownstreamGL() throws GLException {"); + output.println(" return " + getDownstreamObjectName() + ";"); + output.println(" }"); + output.println(" @Override"); + output.println(" public final GLProfile getGLProfile() {"); output.println(" return " + getDownstreamObjectName() + ".getGLProfile();"); output.println(" }"); } -- cgit v1.2.3