shader blackout area

  ... discussions regarding GLES2 ShaderPrograms (VertexShaders and FragmentShaders).

shader blackout area

Postby SLesnik » Fri May 16, 2014 9:11 am

Immediately I ask forgiveness for the bad english
I have here is a shader
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. #ifdef GL_ES
  2. precision highp float;
  3. #endif
  4.  
  5. varying vec4 v_fragmentColor;          
  6. varying vec2 v_texCoord;               
  7.        
  8. uniform         float u_darkness_max, u_hole_radius0, u_hole_radius1;
  9. uniform      vec2 u_screen_size;
  10. uniform      vec2 u_hole_position0, u_hole_position1;
  11.  
  12. void main()
  13. {    
  14.     float distanceSqr = dot((v_texCoord-u_hole_position0) * u_screen_size, (v_texCoord-u_hole_position0) * u_screen_size);
  15.     float alfa0 = clamp((distanceSqr/(u_hole_radius0*u_hole_radius0) - 0.05)/0.95, 0.0, 1.0);
  16.    
  17.     distanceSqr = dot((v_texCoord-u_hole_position1) * u_screen_size, (v_texCoord-u_hole_position1) * u_screen_size);
  18.     float alfa1 = clamp((distanceSqr/(u_hole_radius1*u_hole_radius1) - 0.05)/0.95, 0.0, 1.0);
  19.  
  20.     gl_FragColor = vec4(0.0, 0.0, 0.0, alfa1 * alfa0 * u_darkness_max);
  21. }
Parsed in 0.012 seconds, using GeSHi 1.0.8.4

I need help with this link() and bind()
SLesnik
 
Posts: 1
Joined: Fri May 16, 2014 9:05 am

Return to ShaderPrograms

Who is online

Users browsing this forum: No registered users and 1 guest