image_viewer.vert 674 B

12345678910111213141516171819202122232425262728
  1. /*
  2. * Copyright (C) 2020, Inria
  3. * GRAPHDECO research group, https://team.inria.fr/graphdeco
  4. * All rights reserved.
  5. *
  6. * This software is free for non-commercial, research and evaluation use
  7. * under the terms of the LICENSE.md file.
  8. *
  9. * For inquiries contact sibr@inria.fr and/or George.Drettakis@inria.fr
  10. */
  11. #version 420
  12. layout(location = 0) in vec3 in_vertex;
  13. uniform float scale;
  14. uniform vec2 pos;
  15. uniform vec2 size;
  16. uniform bool correctRatio;
  17. out vec2 texcoord;
  18. void main(void) {
  19. vec2 position = scale * vec2(1.0, correctRatio ? (size.y/size.x) : 1.0) * in_vertex.xy + pos;
  20. gl_Position = vec4(in_vertex.xy, 0.0, 1.0);
  21. texcoord = position * 0.5 + 0.5;
  22. }