Browse Source

tutorial: minor shader tweaks in the line plot shader.

legacy
Sam Hocevar sam 12 years ago
parent
commit
c71a033890
1 changed files with 11 additions and 13 deletions
  1. +11
    -13
      tutorial/04_texture.lolfx

+ 11
- 13
tutorial/04_texture.lolfx View File

@@ -52,21 +52,19 @@ void main(void)
vec2 tc0 = tc1 - vec2(1.0, 1.0) / 128.0;
vec2 tc3 = tc2 + vec2(1.0, 1.0) / 128.0;

float c0 = texture2D(u_Texture, tc0).x;
float c1 = texture2D(u_Texture, tc1).x;
float c2 = texture2D(u_Texture, tc2).x;
float c3 = texture2D(u_Texture, tc3).x;
vec4 c;
c[0] = texture2D(u_Texture, tc0).x;
c[1] = texture2D(u_Texture, tc1).x;
c[2] = texture2D(u_Texture, tc2).x;
c[3] = texture2D(u_Texture, tc3).x;

/* Artificially compress in Y */
c0 *= 0.3;
c1 *= 0.3;
c2 *= 0.3;
c3 *= 0.3;

vec2 p0 = vec2(tc0.x * width, c0 * height);
vec2 p1 = vec2(tc1.x * width, c1 * height);
vec2 p2 = vec2(tc2.x * width, c2 * height);
vec2 p3 = vec2(tc3.x * width, c3 * height);
c *= 0.3;

vec2 p0 = vec2(tc0.x * width, c[0] * height);
vec2 p1 = vec2(tc1.x * width, c[1] * height);
vec2 p2 = vec2(tc2.x * width, c[2] * height);
vec2 p3 = vec2(tc3.x * width, c[3] * height);
vec2 a = vec2(t.x * width, t.y * height);

float d0 = point2segment(p0, p1, a);


Loading…
Cancel
Save