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.
 
 
 
 
 

29 lines
711 B

  1. [vert.glsl]
  2. #version 120
  3. void main()
  4. {
  5. gl_Position = gl_Vertex;
  6. gl_TexCoord[0] = gl_MultiTexCoord0;
  7. }
  8. [frag.glsl]
  9. #version 120
  10. uniform sampler2D texture;
  11. uniform vec2 screen_size;
  12. uniform vec4 mirror;
  13. void main(void)
  14. {
  15. vec2 p = gl_TexCoord[0].xy;
  16. vec3 source = texture2D(texture, p).xyz;
  17. vec3 color = vec3(0.0);
  18. if(p.x < mirror.x) color = (texture2D(texture, vec2(mirror.x - (1.0 - mirror.x * mirror.w + p.x * mirror.w), p.y)).xyz) * (mirror.z / mirror.x * p.x);
  19. if(p.x > 1.0 - mirror.x) color = (texture2D(texture, vec2(mirror.x - (1.0 - mirror.x * mirror.w + p.x * mirror.w), p.y)).xyz) * (mirror.z / mirror.x * (1.0 - p.x));
  20. gl_FragColor = vec4(source + color, 1.0);
  21. }