aboutsummaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/com/jogamp/opengl/util/glsl
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2012-10-12 15:10:29 +0200
committerSven Gothel <[email protected]>2012-10-12 15:10:29 +0200
commite3ee1e25276760cba5db0333301d3ba19d62dd69 (patch)
tree0d7a01e14de75132856e77b619837b1887d5456a /src/jogl/classes/com/jogamp/opengl/util/glsl
parentda258d10d4e929bb2993e7a0329ad32d079fd731 (diff)
Enhance FixedFuncPipeline: Multi-Texture, Tex-Env, Alpha-Test, Lighting (fix, incomplete still), ShaderSelectionMode, Fix default values
Besides the above mentioned additional features towards completness of the FFP emu, the ShaderSelectionMode allows fixating a shader program configuration, i.e. AUTO switch (default) or choosing a static shader program to avoid heavy program switches incl. uniform/attribute updates.
Diffstat (limited to 'src/jogl/classes/com/jogamp/opengl/util/glsl')
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/glsl/fixedfunc/FixedFuncUtil.java46
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/glsl/fixedfunc/ShaderSelectionMode.java23
2 files changed, 60 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 d92a7aa22..a653bd467 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
@@ -4,26 +4,45 @@
package com.jogamp.opengl.util.glsl.fixedfunc;
-import javax.media.opengl.*;
-import javax.media.opengl.fixedfunc.*;
+import javax.media.opengl.GL;
+import javax.media.opengl.GL2ES1;
+import javax.media.opengl.GL2ES2;
+import javax.media.opengl.GLContext;
+import javax.media.opengl.GLException;
+import javax.media.opengl.fixedfunc.GLPointerFuncUtil;
+
+import jogamp.opengl.util.glsl.fixedfunc.FixedFuncHook;
+import jogamp.opengl.util.glsl.fixedfunc.FixedFuncImpl;
+import jogamp.opengl.util.glsl.fixedfunc.FixedFuncPipeline;
+
+import com.jogamp.opengl.util.PMVMatrix;
-import jogamp.opengl.util.glsl.fixedfunc.*;
/**
* Tool to pipeline GL2ES2 into a fixed function emulation implementing GL2ES1.
*/
public class FixedFuncUtil {
/**
+ * @param gl
+ * @param mode one of the {@link ShaderSelectionMode}s
+ * @param pmvMatrix optional pass through PMVMatrix for the {@link FixedFuncHook} and {@link FixedFuncPipeline}
* @return If gl is a GL2ES1 and force is false, return the type cast object,
* 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
+ *
+ * @see ShaderSelectionMode#AUTO
+ * @see ShaderSelectionMode#COLOR
+ * @see ShaderSelectionMode#COLOR_LIGHT_PER_VERTEX
+ * @see ShaderSelectionMode#COLOR_TEXTURE
+ * @see ShaderSelectionMode#COLOR_TEXTURE_LIGHT_PER_VERTEX
*/
- public static final GL2ES1 wrapFixedFuncEmul(GL gl, boolean force) {
+ public static final GL2ES1 wrapFixedFuncEmul(GL gl, ShaderSelectionMode mode, PMVMatrix pmvMatrix, boolean force, boolean verbose) {
if(gl.isGL2ES2() && ( !gl.isGL2ES1() || force ) ) {
- GL2ES2 es2 = gl.getGL2ES2();
- FixedFuncHook hook = new FixedFuncHook(es2);
- FixedFuncImpl impl = new FixedFuncImpl(es2, hook);
+ final GL2ES2 es2 = gl.getGL2ES2();
+ final FixedFuncHook hook = new FixedFuncHook(es2, mode, pmvMatrix);
+ hook.setVerbose(verbose);
+ final FixedFuncImpl impl = new FixedFuncImpl(es2, hook);
gl.getContext().setGL(impl);
return impl;
} else if(gl.isGL2ES1()) {
@@ -33,13 +52,22 @@ public class FixedFuncUtil {
}
/**
+ * @param gl
+ * @param mode one of the {@link ShaderSelectionMode}s
+ * @param pmvMatrix optional pass through PMVMatrix for the {@link FixedFuncHook} and {@link FixedFuncPipeline}
* @return If gl is a GL2ES1, return the type cast object,
* 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
+ *
+ * @see ShaderSelectionMode#AUTO
+ * @see ShaderSelectionMode#COLOR
+ * @see ShaderSelectionMode#COLOR_LIGHT_PER_VERTEX
+ * @see ShaderSelectionMode#COLOR_TEXTURE
+ * @see ShaderSelectionMode#COLOR_TEXTURE_LIGHT_PER_VERTEX
*/
- public static final GL2ES1 wrapFixedFuncEmul(GL gl) {
- return wrapFixedFuncEmul(gl, false);
+ public static final GL2ES1 wrapFixedFuncEmul(GL gl, ShaderSelectionMode mode, PMVMatrix pmvMatrix) {
+ return wrapFixedFuncEmul(gl, mode, null, false, false);
}
/**
diff --git a/src/jogl/classes/com/jogamp/opengl/util/glsl/fixedfunc/ShaderSelectionMode.java b/src/jogl/classes/com/jogamp/opengl/util/glsl/fixedfunc/ShaderSelectionMode.java
new file mode 100644
index 000000000..fba4b755e
--- /dev/null
+++ b/src/jogl/classes/com/jogamp/opengl/util/glsl/fixedfunc/ShaderSelectionMode.java
@@ -0,0 +1,23 @@
+package com.jogamp.opengl.util.glsl.fixedfunc;
+
+/**
+ * Shader selection mode
+ *
+ * @see ShaderSelectionMode#AUTO
+ * @see ShaderSelectionMode#COLOR
+ * @see ShaderSelectionMode#COLOR_LIGHT_PER_VERTEX
+ * @see ShaderSelectionMode#COLOR_TEXTURE
+ * @see ShaderSelectionMode#COLOR_TEXTURE_LIGHT_PER_VERTEX
+ */
+public enum ShaderSelectionMode {
+ /** Auto shader selection, based upon FFP states. */
+ AUTO,
+ /** Fixed shader selection: Simple color. */
+ COLOR,
+ /** Fixed shader selection: Multi-Textured color. */
+ COLOR_TEXTURE,
+ /** Fixed shader selection: Color with vertex-lighting. */
+ COLOR_LIGHT_PER_VERTEX,
+ /** Fixed shader selection: Multi-Textured color with vertex-lighting. */
+ COLOR_TEXTURE_LIGHT_PER_VERTEX
+} \ No newline at end of file