- float view_height = tan(camera.get_field_of_view()/2)*2;
- float xx = ((float(x)-window.get_width()/2)/window.get_height())*view_height;
- float yy = (float(y)/window.get_height()-0.5)*view_height;
- float size = 4.0/window.get_height()*view_height;
-
- camera.apply();
+ const GL::Vector3 &start = camera.get_position();
+ float xx = x*2.0/window.get_width()-1.0;
+ float yy = y*2.0/window.get_height()-1.0;
+ GL::Vector4 ray = camera.unproject(GL::Vector4(xx, yy, 0, 0));