aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2011-04-08 14:56:18 +0200
committerSven Gothel <[email protected]>2011-04-08 14:56:18 +0200
commite48537024014104e517d988907eb102154679f88 (patch)
treec205942ccd4082c5c872183a6420416963e3acca /src
parent349a22d3a87f6e3dd87c3b4151447588969de8b6 (diff)
Use common constants for shader attributes (needs to be completed)
Diffstat (limited to 'src')
-rwxr-xr-xsrc/jogl/classes/com/jogamp/graph/curve/Region.java12
-rw-r--r--src/jogl/classes/com/jogamp/graph/curve/opengl/Renderer.java3
-rwxr-xr-xsrc/jogl/classes/jogamp/graph/curve/opengl/RegionRendererImpl01.java4
-rw-r--r--src/jogl/classes/jogamp/graph/curve/opengl/TextRendererImpl01.java4
4 files changed, 18 insertions, 5 deletions
diff --git a/src/jogl/classes/com/jogamp/graph/curve/Region.java b/src/jogl/classes/com/jogamp/graph/curve/Region.java
index 051cb1c38..e238889e0 100755
--- a/src/jogl/classes/com/jogamp/graph/curve/Region.java
+++ b/src/jogl/classes/com/jogamp/graph/curve/Region.java
@@ -29,6 +29,9 @@ package com.jogamp.graph.curve;
import java.util.ArrayList;
+import jogamp.opengl.Debug;
+
+import com.jogamp.graph.curve.opengl.Renderer;
import com.jogamp.graph.geom.Triangle;
import com.jogamp.graph.geom.Vertex;
import com.jogamp.opengl.util.PMVMatrix;
@@ -44,14 +47,23 @@ import com.jogamp.opengl.util.PMVMatrix;
* @see RegionFactory, OutlineShape
*/
public interface Region {
+ public static final boolean DEBUG = Debug.debug("graph.curve");
+
/** The vertices index in an OGL object
*/
public static int VERTEX_ATTR_IDX = 0;
+ public static String VERTEX_ATTR_NAME = "v_position";
/** The Texture Coord index in an OGL object
*/
public static int TEXCOORD_ATTR_IDX = 1;
+ public static String TEXCOORD_ATTR_NAME = "texCoord";
+ /** The color index in an OGL object
+ */
+ public static int COLOR_ATTR_IDX = 2;
+ public static String COLOR_ATTR_NAME = "v_color";
+
/** single pass rendering, fast, but AA might not be perfect */
public static int SINGLE_PASS = 1;
diff --git a/src/jogl/classes/com/jogamp/graph/curve/opengl/Renderer.java b/src/jogl/classes/com/jogamp/graph/curve/opengl/Renderer.java
index 57eeb016f..aa14bcbd8 100644
--- a/src/jogl/classes/com/jogamp/graph/curve/opengl/Renderer.java
+++ b/src/jogl/classes/com/jogamp/graph/curve/opengl/Renderer.java
@@ -6,13 +6,14 @@ import javax.media.opengl.fixedfunc.GLMatrixFunc;
import jogamp.opengl.Debug;
+import com.jogamp.graph.curve.Region;
import com.jogamp.graph.geom.Vertex;
import com.jogamp.graph.geom.opengl.SVertex;
import com.jogamp.opengl.util.PMVMatrix;
import com.jogamp.opengl.util.glsl.ShaderState;
public abstract class Renderer {
- protected static final boolean DEBUG = Debug.debug("CurveRenderer");
+ protected static final boolean DEBUG = Region.DEBUG;
protected abstract boolean initImpl(GL2ES2 gl);
diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/RegionRendererImpl01.java b/src/jogl/classes/jogamp/graph/curve/opengl/RegionRendererImpl01.java
index 9208afc24..34b46a8b5 100755
--- a/src/jogl/classes/jogamp/graph/curve/opengl/RegionRendererImpl01.java
+++ b/src/jogl/classes/jogamp/graph/curve/opengl/RegionRendererImpl01.java
@@ -85,8 +85,8 @@ public class RegionRendererImpl01 extends RegionRenderer {
sp.add(rsFp);
sp.init(gl);
- gl.glBindAttribLocation(sp.program(), Region.VERTEX_ATTR_IDX, "v_position");
- gl.glBindAttribLocation(sp.program(), Region.TEXCOORD_ATTR_IDX, "texCoord");
+ gl.glBindAttribLocation(sp.program(), Region.VERTEX_ATTR_IDX, Region.VERTEX_ATTR_NAME);
+ gl.glBindAttribLocation(sp.program(), Region.TEXCOORD_ATTR_IDX, Region.TEXCOORD_ATTR_NAME);
if(!sp.link(gl, System.err)) {
throw new GLException("RegionRenderer: Couldn't link program: "+sp);
diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/TextRendererImpl01.java b/src/jogl/classes/jogamp/graph/curve/opengl/TextRendererImpl01.java
index 01572de58..69a8e470b 100644
--- a/src/jogl/classes/jogamp/graph/curve/opengl/TextRendererImpl01.java
+++ b/src/jogl/classes/jogamp/graph/curve/opengl/TextRendererImpl01.java
@@ -87,8 +87,8 @@ public class TextRendererImpl01 extends TextRenderer {
sp.add(rsFp);
sp.init(gl);
- gl.glBindAttribLocation(sp.program(), Region.VERTEX_ATTR_IDX, "v_position");
- gl.glBindAttribLocation(sp.program(), Region.TEXCOORD_ATTR_IDX, "texCoord");
+ gl.glBindAttribLocation(sp.program(), Region.VERTEX_ATTR_IDX, Region.VERTEX_ATTR_NAME);
+ gl.glBindAttribLocation(sp.program(), Region.TEXCOORD_ATTR_IDX, Region.TEXCOORD_ATTR_NAME);
if(!sp.link(gl, System.err)) {
throw new GLException("TextRendererImpl01: Couldn't link program: "+sp);