Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Apr 29th, 2012  |  syntax: None  |  size: 0.53 KB  |  hits: 17  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. // @@ V SHADER
  2. attribute vec4 position;
  3. attribute vec2 textureCoordinates;
  4. uniform mat4 matrix;
  5. varying vec2 fragmentTextureCoordinates;
  6.  
  7. void main()
  8. {
  9.     gl_Position = matrix * position;
  10.        
  11.     fragmentTextureCoordinates = textureCoordinates;
  12. }
  13.  
  14. // @@ F SHADER
  15. uniform sampler2D texture;
  16. varying mediump vec2 fragmentTextureCoordinates;
  17.  
  18. uniform float alphaThreshold;
  19.  
  20. void main()
  21. {
  22.    gl_FragColor = texture2D(texture, fragmentTextureCoordinates);
  23.    if(gl_FragColor.a<alphaThreshold)
  24.    {
  25.         discard;
  26.    }
  27. }