aboutsummaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/com/jogamp/gluegen
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2013-07-15 22:49:47 +0200
committerSven Gothel <[email protected]>2013-07-15 22:49:47 +0200
commit6136457f10d020c779adc78641d0048f77ab1635 (patch)
treebc47249ff202f2a6f218f5fa4bae155167a590ef /src/jogl/classes/com/jogamp/gluegen
parent4af77a92acf5bc2e27f9dea444a8c84d6775cf77 (diff)
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 ]
Diffstat (limited to 'src/jogl/classes/com/jogamp/gluegen')
-rw-r--r--src/jogl/classes/com/jogamp/gluegen/opengl/BuildComposablePipeline.java49
1 files changed, 36 insertions, 13 deletions
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<Method> publicMethodsRaw = Arrays.asList(classToComposeAround.getMethods());
+ final List<Method> publicMethodsRaw = Arrays.asList(classToComposeAround.getMethods());
- Set<PlainMethod> publicMethodsPlain = new HashSet<PlainMethod>();
+ final Set<PlainMethod> publicMethodsPlain = new HashSet<PlainMethod>();
for (Iterator<Method> 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(" }");
}