|
@@ -0,0 +1,30 @@ |
|
|
|
|
|
[vert.glsl] |
|
|
|
|
|
|
|
|
|
|
|
#version 120 |
|
|
|
|
|
|
|
|
|
|
|
void main() |
|
|
|
|
|
{ |
|
|
|
|
|
gl_Position = gl_Vertex; |
|
|
|
|
|
gl_TexCoord[0] = gl_MultiTexCoord0; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
[frag.glsl] |
|
|
|
|
|
|
|
|
|
|
|
#version 120 |
|
|
|
|
|
|
|
|
|
|
|
uniform sampler2D source; |
|
|
|
|
|
uniform sampler2D buffer; |
|
|
|
|
|
uniform vec2 mix; |
|
|
|
|
|
|
|
|
|
|
|
void main(void) |
|
|
|
|
|
{ |
|
|
|
|
|
vec4 old_color = texture2D(buffer, gl_TexCoord[0].xy); |
|
|
|
|
|
vec4 new_color = texture2D(source, gl_TexCoord[0].xy); |
|
|
|
|
|
|
|
|
|
|
|
/* The old way */ |
|
|
|
|
|
//gl_FragColor = new_color * mix.x + old_color * mix.y; |
|
|
|
|
|
|
|
|
|
|
|
/* The new way: if new_color > old_color we want faster updates */ |
|
|
|
|
|
gl_FragColor = max(new_color, new_color * mix.x + old_color * mix.y); |
|
|
|
|
|
} |
|
|
|
|
|
|