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.

31 lines
675 B

  1. #version 330
  2. // Input vertex attributes (from vertex shader)
  3. in vec2 fragTexCoord;
  4. in vec4 fragColor;
  5. // Input uniform values
  6. uniform sampler2D texture0;
  7. uniform vec4 fragTintColor;
  8. // Output fragment color
  9. out vec4 finalColor;
  10. // NOTE: Add here your custom variables
  11. const float renderWidth = 1280.0;
  12. const float renderHeight = 720.0;
  13. uniform float pixelWidth = 5.0;
  14. uniform float pixelHeight = 5.0;
  15. void main()
  16. {
  17. float dx = pixelWidth*(1.0/renderWidth);
  18. float dy = pixelHeight*(1.0/renderHeight);
  19. vec2 coord = vec2(dx*floor(fragTexCoord.x/dx), dy*floor(fragTexCoord.y/dy));
  20. vec3 tc = texture(texture0, coord).rgb;
  21. finalColor = vec4(tc, 1.0);
  22. }