-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 dave perry wrote: | Patch adds a member function to FGRenderer class that returns the | current aspect ratio. Uses this in place of 4.0/3.0 in setFOV and | setNearFar. | | The diff follows: | This seems a little confusing / confused. In setFOV, why would you ignore the w argument? Now, I happen to know that /sim/startup/xsize is set to the value of w somewhere in one of the callers, but this is not clear at all. Can we untangle this a bit?
Thanks for the bug fix all the same. I think we've blown off this problem because it was unclear how to deal with multiple cameras (monitors / graphics cards), but now we're only coding to the osgViewer interface, so it will be easier to arrive at a coherent solution. Tim | ? renderer.diff | Index: renderer.cxx | =================================================================== | RCS file: /var/cvs/FlightGear-0.9/source/src/Main/renderer.cxx,v | retrieving revision 1.100 | diff -p -u -r1.100 renderer.cxx | --- renderer.cxx 6 Jan 2008 23:03:20 -0000 1.100 | +++ renderer.cxx 16 Jan 2008 22:41:59 -0000 | @@ -864,6 +864,11 @@ static float fov_height = 42.0; | static float fov_near = 1.0; | static float fov_far = 1000.0; | | +float FGRenderer::getAspectRatio() { | + float xsize = fgGetInt("/sim/startup/xsize"); | + float ysize = fgGetInt("/sim/startup/ysize"); | + return xsize/ysize; | +} | | /** FlightGear code should use this routine to set the FOV rather than | * calling the ssg routine directly | @@ -872,7 +877,7 @@ void FGRenderer::setFOV( float w, float | fov_width = w; | fov_height = h; | osgViewer::Viewer* viewer = globals->get_renderer()->getViewer(); | - viewer->getCamera()->setProjectionMatrixAsPerspective(fov_height, | 4.0/3.0, | + viewer->getCamera()->setProjectionMatrixAsPerspective(fov_height, | FGRenderer::getAspectRatio(), | fov_near, | fov_far); | } | | @@ -886,7 +891,7 @@ n = 0.1; | fov_near = n; | fov_far = f; | osgViewer::Viewer* viewer = globals->get_renderer()->getViewer(); | - viewer->getCamera()->setProjectionMatrixAsPerspective(fov_height, | 4.0/3.0, | + viewer->getCamera()->setProjectionMatrixAsPerspective(fov_height, | FGRenderer::getAspectRatio(), | fov_near, | fov_far); | } | | Index: renderer.hxx | =================================================================== | RCS file: /var/cvs/FlightGear-0.9/source/src/Main/renderer.hxx,v | retrieving revision 1.17 | diff -p -u -r1.17 renderer.hxx | --- renderer.hxx 21 Nov 2007 20:51:50 -0000 1.17 | +++ renderer.hxx 16 Jan 2008 22:41:59 -0000 | @@ -32,6 +32,8 @@ public: | void splashinit(); | void init(); | | + static float getAspectRatio(); | + | static void resize(int width, int height ); | | // calling update( refresh_camera_settings = false ) will not | | ------------------------------------------------------------------------- | This SF.net email is sponsored by: Microsoft | Defy all challenges. Microsoft(R) Visual Studio 2008. | http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ | _______________________________________________ | Flightgear-devel mailing list | Flightgear-devel@lists.sourceforge.net | https://lists.sourceforge.net/lists/listinfo/flightgear-devel | -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.7 (GNU/Linux) Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org iD8DBQFHkfVteDhWHdXrDRURAuz6AJ9pU8rKI5Ww6/D+PYlLxEgOdJ997QCg1GKl dmuKp9gtD9vs5EY/zgIoMKY= =RgZN -----END PGP SIGNATURE----- ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ Flightgear-devel mailing list Flightgear-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/flightgear-devel