always-discard.frag 664 B

12345678910111213141516171819202122232425262728293031323334353637
  1. #version 110
  2. varying vec2 tex_coord;
  3. void main (void)
  4. {
  5. vec4 white = vec4(1.0);
  6. vec4 black = vec4(0.2);
  7. vec4 color = white;
  8. // First, cut out our circle
  9. float x = tex_coord.x*2.0 - 1.0;
  10. float y = tex_coord.y*2.0 - 1.0;
  11. float radius = sqrt(x*x + y*y);
  12. if (radius > 1.0) {
  13. if (radius > 1.1) {
  14. ++color;
  15. }
  16. gl_FragColor = color;
  17. if (radius > 1.2) {
  18. ++color;
  19. }
  20. }
  21. discard;
  22. // If we're near an edge, darken us a tiny bit
  23. if (radius >= 0.75)
  24. color -= abs(pow(radius, 16.0)/2.0);
  25. gl_FragColor = color;
  26. }