kinectLike-test.frag~ 534 B

123456789101112131415161718192021222324
  1. varying vec4 obj_pos;
  2. uniform float pos;
  3. uniform float thres;
  4. uniform float limit;
  5. void main (void)
  6. {
  7. vec4 color = gl_Color;
  8. color.r = cos(obj_pos.z);
  9. color.g = cos(obj_pos.z+3.14*2.*0.333);
  10. color.b = 0.5;
  11. // color.b = cos(depth+3.14*2.*0.666);
  12. if (abs(obj_pos.x) > limit || abs(obj_pos.y) > limit || abs(obj_pos.z) > limit )
  13. {color.a *= 0;}
  14. // else {color.a = 1;}
  15. if (obj_pos.z >= pos+thres/2 || obj_pos.z <= pos-thres/2){color.a=0;}
  16. // else {color.a = 1;}
  17. //else {color.a=1;}
  18. // color.r=0;}
  19. gl_FragColor = color;
  20. }
  21. //