aboutsummaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/jogamp/graph/curve/opengl/shader
diff options
context:
space:
mode:
Diffstat (limited to 'src/jogl/classes/jogamp/graph/curve/opengl/shader')
-rw-r--r--src/jogl/classes/jogamp/graph/curve/opengl/shader/AttributeNames.java1
-rw-r--r--src/jogl/classes/jogamp/graph/curve/opengl/shader/UniformNames.java2
-rw-r--r--src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass1-curve_simple.glsl14
-rw-r--r--src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass1.vp5
-rw-r--r--src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-single.vp5
-rw-r--r--src/jogl/classes/jogamp/graph/curve/opengl/shader/uniforms.glsl12
-rw-r--r--src/jogl/classes/jogamp/graph/curve/opengl/shader/varyings.glsl4
7 files changed, 32 insertions, 11 deletions
diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/shader/AttributeNames.java b/src/jogl/classes/jogamp/graph/curve/opengl/shader/AttributeNames.java
index b2c73a2e4..dff536645 100644
--- a/src/jogl/classes/jogamp/graph/curve/opengl/shader/AttributeNames.java
+++ b/src/jogl/classes/jogamp/graph/curve/opengl/shader/AttributeNames.java
@@ -44,6 +44,7 @@ public class AttributeNames {
public static final String COLOR_ATTR_NAME = "gca_Colors";
public static final String FBO_VERTEX_ATTR_NAME = "gca_FboVertices";
+
public static final String FBO_TEXCOORDS_ATTR_NAME = "gca_FboTexCoords";
}
diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/shader/UniformNames.java b/src/jogl/classes/jogamp/graph/curve/opengl/shader/UniformNames.java
index f37025516..7244851ff 100644
--- a/src/jogl/classes/jogamp/graph/curve/opengl/shader/UniformNames.java
+++ b/src/jogl/classes/jogamp/graph/curve/opengl/shader/UniformNames.java
@@ -4,6 +4,8 @@ public class UniformNames {
public static final String gcu_PMVMatrix01 = "gcu_PMVMatrix01"; // gcu_PMVMatrix[3]; // P, Mv, and Mvi
public static final String gcu_ColorStatic = "gcu_ColorStatic";
public static final String gcu_Weight = "gcu_Weight";
+ public static final String gcu_ColorTexUnit = "gcu_ColorTexUnit";
+ public static final String gcu_ColorTexBBox = "gcu_ColorTexBBox";
public static final String gcu_PMVMatrix02 = "gcu_PMVMatrix02"; // gcu_PMVMatrix[3]; // P, Mv, and Mvi
public static final String gcu_FboTexUnit = "gcu_FboTexUnit";
diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass1-curve_simple.glsl b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass1-curve_simple.glsl
index 373e8d575..83b312a0b 100644
--- a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass1-curve_simple.glsl
+++ b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass1-curve_simple.glsl
@@ -1,7 +1,11 @@
if( gcv_CurveParam.x == 0.0 && gcv_CurveParam.y == 0.0 ) {
// pass-1: Lines
-#ifdef USE_COLOR_CHANNEL
+#if defined(USE_COLOR_TEXTURE) && defined(USE_COLOR_CHANNEL)
+ mgl_FragColor = texture2D(gcu_ColorTexUnit, gcv_ColorTexCoord.st) * gcv_Color * gcu_ColorStatic;
+#elif defined(USE_COLOR_TEXTURE)
+ mgl_FragColor = texture2D(gcu_ColorTexUnit, gcv_ColorTexCoord.st) * gcu_ColorStatic;
+#elif defined(USE_COLOR_CHANNEL)
mgl_FragColor = gcv_Color * gcu_ColorStatic;
#else
mgl_FragColor = gcu_ColorStatic;
@@ -17,7 +21,13 @@
float position = rtex.y - (rtex.x * (1.0 - rtex.x));
float a = clamp(0.5 - ( position/length(f) ) * sign(gcv_CurveParam.y), 0.0, 1.0);
-#ifdef USE_COLOR_CHANNEL
+#if defined(USE_COLOR_TEXTURE) && defined(USE_COLOR_CHANNEL)
+ vec4 t = texture2D(gcu_ColorTexUnit, gcv_ColorTexCoord.st);
+ mgl_FragColor = vec4(t.rgb * gcv_Color.rgb * gcu_ColorStatic.rgb, t.a * gcv_Color.a * gcu_ColorStatic.a * a);
+#elif defined(USE_COLOR_TEXTURE)
+ vec4 t = texture2D(gcu_ColorTexUnit, gcv_ColorTexCoord.st);
+ mgl_FragColor = vec4(t.rgb * gcu_ColorStatic.rgb, t.a * gcu_ColorStatic.a * a);
+#elif defined(USE_COLOR_CHANNEL)
mgl_FragColor = vec4(gcv_Color.rgb * gcu_ColorStatic.rgb, gcv_Color.a * gcu_ColorStatic.a * a);
#else
mgl_FragColor = vec4(gcu_ColorStatic.rgb, gcu_ColorStatic.a * a);
diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass1.vp b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass1.vp
index 46729cfd0..c6ed4ca58 100644
--- a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass1.vp
+++ b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass1.vp
@@ -11,7 +11,6 @@
void main(void)
{
- // gl_Position = gcu_PMVMatrix02[0] * gcu_PMVMatrix02[1] * vec4(gca_Vertices, 1);
gl_Position = gcu_PMVMatrix02[0] * gcu_PMVMatrix02[1] * gca_Vertices;
#if 1
gcv_CurveParam = gca_CurveParams;
@@ -24,6 +23,10 @@ void main(void)
gcv_CurveParam = gca_CurveParams;
}
#endif
+#ifdef USE_COLOR_TEXTURE
+ vec2 dim = vec2(gcu_ColorTexBBox.z - gcu_ColorTexBBox.x, gcu_ColorTexBBox.w - gcu_ColorTexBBox.y);
+ gcv_ColorTexCoord = vec2(gca_Vertices.x - gcu_ColorTexBBox.x, gca_Vertices.y - gcu_ColorTexBBox.y) / dim;
+#endif
#ifdef USE_COLOR_CHANNEL
gcv_Color = gca_Colors;
#endif
diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-single.vp b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-single.vp
index 7598c23f8..14210be39 100644
--- a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-single.vp
+++ b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-single.vp
@@ -11,7 +11,6 @@
void main(void)
{
- // gl_Position = gcu_PMVMatrix01[0] * gcu_PMVMatrix01[1] * vec4(gca_Vertices, 1);
gl_Position = gcu_PMVMatrix01[0] * gcu_PMVMatrix01[1] * gca_Vertices;
#if 1
gcv_CurveParam = gca_CurveParams;
@@ -24,6 +23,10 @@ void main(void)
gcv_CurveParam = gca_CurveParams;
}
#endif
+#ifdef USE_COLOR_TEXTURE
+ vec2 dim = vec2(gcu_ColorTexBBox.z - gcu_ColorTexBBox.x, gcu_ColorTexBBox.w - gcu_ColorTexBBox.y);
+ gcv_ColorTexCoord = vec2(gca_Vertices.x - gcu_ColorTexBBox.x, gca_Vertices.y - gcu_ColorTexBBox.y) / dim;
+#endif
#ifdef USE_COLOR_CHANNEL
gcv_Color = gca_Colors;
#endif
diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/shader/uniforms.glsl b/src/jogl/classes/jogamp/graph/curve/opengl/shader/uniforms.glsl
index 848c26819..ae7fa8490 100644
--- a/src/jogl/classes/jogamp/graph/curve/opengl/shader/uniforms.glsl
+++ b/src/jogl/classes/jogamp/graph/curve/opengl/shader/uniforms.glsl
@@ -6,6 +6,11 @@ uniform mat4 gcu_PMVMatrix01[3]; // P, Mv, and Mvi
uniform vec4 gcu_ColorStatic;
uniform float gcu_Weight;
+#ifdef USE_COLOR_TEXTURE
+ uniform sampler2D gcu_ColorTexUnit;
+ uniform vec4 gcu_ColorTexBBox;
+#endif
+
uniform mat4 gcu_PMVMatrix02[3]; // P, Mv, and Mvi
uniform sampler2D gcu_FboTexUnit;
@@ -14,11 +19,4 @@ uniform sampler2D gcu_FboTexUnit;
*/
uniform vec2 gcu_FboTexSize;
-// const int MAX_TEXTURE_UNITS = 8; // <= gl_MaxTextureImageUnits
-// const int MAX_LIGHTS = 8;
-// uniform mat3 gcu_NormalMatrix; // transpose(inverse(ModelView)).3x3
-// uniform int gcu_ColorEnabled;
-// uniform int gcu_TexCoordEnabled[MAX_TEXTURE_UNITS];
-// uniform int gcu_CullFace;
-
#endif // uniforms_glsl
diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/shader/varyings.glsl b/src/jogl/classes/jogamp/graph/curve/opengl/shader/varyings.glsl
index 2054c9c21..265ab6915 100644
--- a/src/jogl/classes/jogamp/graph/curve/opengl/shader/varyings.glsl
+++ b/src/jogl/classes/jogamp/graph/curve/opengl/shader/varyings.glsl
@@ -6,6 +6,10 @@ varying vec3 gcv_CurveParam;
varying vec2 gcv_FboTexCoord;
+#ifdef USE_COLOR_TEXTURE
+ varying vec2 gcv_ColorTexCoord;
+#endif
+
#ifdef USE_COLOR_CHANNEL
varying vec4 gcv_Color;
#endif