Advertisement
Guest User

Untitled

a guest
Mar 28th, 2017
46
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.11 KB | None | 0 0
  1. //uniform vec2 resolution
  2.  
  3. void main() {
  4. //coordinate systems
  5. vec2 r = vec2((gl_FragCoord.xy - 0.5*resolution.xy)/resolution.y) * 2.0; // Is [-1, 1] coordinate system
  6. vec2 p = vec2(gl_FragCoord.xy/resolution.xy); //[0,1] coordinate system
  7.  
  8. //Set background color
  9. vec3 bgCol = vec3(0.0); // black
  10. vec3 pixel = bgCol;
  11.  
  12. vec3 rAxesColor = vec3(0.537, 1.0, 0.364);
  13. float rAxesThickness = 0.006;
  14.  
  15. vec3 pAxesColor = vec3(1.0, 0.412, 0.635);
  16. float pAxesThickness = 0.008;
  17.  
  18. // --------------------------------------
  19. // --------------------------------------
  20. // -------- Start Fancy Code ------------
  21. // -------- "Code Here" -------------
  22. // -------- End Fancy Code---------------
  23. // --------------------------------------
  24. // --------------------------------------
  25.  
  26. //[0,1] coordinat system axes
  27. if(abs(p.x) < pAxesThickness) pixel = pAxesColor;
  28. if(abs(p.y) < pAxesThickness) pixel = pAxesColor;
  29.  
  30. //[-1,1] coordinat system axes
  31. if(abs(r.x) < rAxesThickness) pixel = rAxesColor;
  32. if(abs(r.y) < rAxesThickness) pixel = rAxesColor;
  33.  
  34. //Final output
  35. gl_FragColor = vec4(pixel, 1.0);
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement