billboard.vert 406 B

123456789101112131415161718192021
  1. uniform mat4 ModelViewMatrix;
  2. uniform vec3 Position;
  3. uniform vec2 Size;
  4. #if __VERSION__ >= 330
  5. layout(location = 0) in vec2 Corner;
  6. layout(location = 3) in vec2 Texcoord;
  7. #else
  8. in vec2 Corner;
  9. in vec2 Texcoord;
  10. #endif
  11. out vec2 uv;
  12. void main(void)
  13. {
  14. uv = Texcoord;
  15. vec4 Center = ModelViewMatrix * vec4(Position, 1.);
  16. gl_Position = ProjectionMatrix * (Center + vec4(Size * Corner, 0., 0.));
  17. }