sprite_local_uv.vp 594 B

1234567891011121314151617181920212223242526
  1. #version 140
  2. // positions are in world space
  3. in highp vec4 position;
  4. in mediump vec2 texcoord0;
  5. // position in local space
  6. in highp vec2 position_local;
  7. // size of sprite in pixels
  8. in mediump vec2 sprite_size;
  9. out mediump vec2 var_texcoord0;
  10. out highp vec2 var_position_local;
  11. uniform vs_uniforms
  12. {
  13. highp mat4 view_proj;
  14. };
  15. void main()
  16. {
  17. gl_Position = view_proj * vec4(position.xyz, 1.0);
  18. var_texcoord0 = texcoord0;
  19. // calculate normalized local position and pass it on to the fragment program
  20. var_position_local = (position_local + sprite_size * 0.5) / sprite_size;
  21. }