You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

35 lines
646 B

  1. [vert.glsl]
  2. #version 120
  3. varying vec2 pass_TexCoord;
  4. void main()
  5. {
  6. gl_Position = gl_Vertex;
  7. pass_TexCoord = vec2(0.5, 0.5) + 0.5 * gl_Vertex.xy;
  8. }
  9. [frag.glsl]
  10. #version 120
  11. varying vec2 pass_TexCoord;
  12. uniform sampler2D source;
  13. uniform sampler2D buffer;
  14. uniform vec2 mix;
  15. void main(void)
  16. {
  17. vec4 old_color = texture2D(buffer, pass_TexCoord);
  18. vec4 new_color = texture2D(source, pass_TexCoord);
  19. /* The old way */
  20. //gl_FragColor = new_color * mix.x + old_color * mix.y;
  21. /* The new way: if new_color > old_color we want faster updates */
  22. gl_FragColor = max(new_color, new_color * mix.x + old_color * mix.y);
  23. }