options_120.vs 471 B

12345678910111213141516171819202122
  1. #version 120
  2. uniform bool use_fixed_screen_size;
  3. uniform float zoom;
  4. uniform float point_size;
  5. uniform float near_plane_height;
  6. float fixed_screen_size()
  7. {
  8. return point_size;
  9. }
  10. float fixed_world_size()
  11. {
  12. return (gl_Position.w == 1.0) ? zoom * near_plane_height * point_size : near_plane_height * point_size / gl_Position.w;
  13. }
  14. void main()
  15. {
  16. gl_Position = ftransform();
  17. gl_PointSize = use_fixed_screen_size ? fixed_screen_size() : fixed_world_size();
  18. }