summaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/com/jogamp/opengl/util
diff options
context:
space:
mode:
Diffstat (limited to 'src/jogl/classes/com/jogamp/opengl/util')
-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