aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2011-07-31 20:40:56 +0200
committerSven Gothel <[email protected]>2011-07-31 20:40:56 +0200
commit99df2204c92eb06b37fba6ff75aa6b7f5e803502 (patch)
tree0620fc095a5009992ea1deab15311fe1186b9bda
parent3349511aeb68c1228e420b3c1ea1758bb75d3e03 (diff)
FixedFuncUtil: Name/Fix getFixedFuncImpl() -> wrapFixedFuncEmul()
Fix wrapFixedFuncEmul(): - only wrap if ES2 and (!ES1 || force) - return same profile if ES1 - otherwise throw exception
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/glsl/fixedfunc/FixedFuncUtil.java18
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/demos/es1/RedSquare.java2
2 files changed, 11 insertions, 9 deletions
diff --git a/src/jogl/classes/com/jogamp/opengl/util/glsl/fixedfunc/FixedFuncUtil.java b/src/jogl/classes/com/jogamp/opengl/util/glsl/fixedfunc/FixedFuncUtil.java
index 9d7eecb60..c2b3308db 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/glsl/fixedfunc/FixedFuncUtil.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/glsl/fixedfunc/FixedFuncUtil.java
@@ -15,29 +15,31 @@ import jogamp.opengl.util.glsl.fixedfunc.*;
public class FixedFuncUtil {
/**
* @return If gl is a GL2ES1 and force is false, return the type cast object,
- * otherwise create a fixed function emulation pipeline with the GL2ES2 impl.
+ * otherwise create a fixed function emulation pipeline using the given GL2ES2 impl
+ * and hook it to the GLContext via {@link GLContext#setGL(GL)}.
* @throws GLException if the GL object is neither GL2ES1 nor GL2ES2
*/
- public static final GL2ES1 getFixedFuncImpl(GL gl, boolean force) {
- if(!force && gl.isGL2ES1()) {
- return gl.getGL2ES1();
- } else if(gl.isGL2ES2()) {
+ public static final GL2ES1 wrapFixedFuncEmul(GL gl, boolean force) {
+ if(gl.isGL2ES2() && ( !gl.isGL2ES1() || force ) ) {
GL2ES2 es2 = gl.getGL2ES2();
FixedFuncHook hook = new FixedFuncHook(es2);
FixedFuncImpl impl = new FixedFuncImpl(es2, hook);
gl.getContext().setGL(impl);
return impl;
+ } else if(gl.isGL2ES1()) {
+ return gl.getGL2ES1();
}
throw new GLException("GL Object is neither GL2ES1 nor GL2ES2: "+gl.getContext());
}
/**
* @return If gl is a GL2ES1, return the type cast object,
- * otherwise create a fixed function emulation pipeline with the GL2ES2 impl.
+ * otherwise create a fixed function emulation pipeline using the GL2ES2 impl.
+ * and hook it to the GLContext via {@link GLContext#setGL(GL)}.
* @throws GLException if the GL object is neither GL2ES1 nor GL2ES2
*/
- public static final GL2ES1 getFixedFuncImpl(GL gl) {
- return getFixedFuncImpl(gl, false);
+ public static final GL2ES1 wrapFixedFuncEmul(GL gl) {
+ return wrapFixedFuncEmul(gl, false);
}
/**
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es1/RedSquare.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es1/RedSquare.java
index eaf697a10..5b7f1d12a 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es1/RedSquare.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es1/RedSquare.java
@@ -61,7 +61,7 @@ public class RedSquare implements GLEventListener {
glTrace = false;
}
- GL2ES1 gl = FixedFuncUtil.getFixedFuncImpl(_gl);
+ GL2ES1 gl = FixedFuncUtil.wrapFixedFuncEmul(_gl);
if(swapInterval>=0) {
gl.setSwapInterval(swapInterval);
}