[Flightgear-devel] renderer.cxx patch - fix non-4:3 aspect ratio distortion

2008-01-15 Thread dave perry
Patch fixes the bad assumption in osg fgfs that aspect ratio is always 
4:3.  I tested all the standard views and also resizing the window.  
Would someone with cvs submit capability check the patch and then commit it.


- Dave P.


? 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 -	1.100
+++ renderer.cxx	15 Jan 2008 21:22:27 -
@@ -871,8 +871,9 @@ static float fov_far = 1000.0;
 void FGRenderer::setFOV( float w, float h ) {
 fov_width = w;
 fov_height = h;
+float aspect_ratio = fgGetDouble(/sim/startup/xsize, 0.0)/fgGetDouble(/sim/startup/ysize, 0.0);
 osgViewer::Viewer* viewer = globals-get_renderer()-getViewer();
-viewer-getCamera()-setProjectionMatrixAsPerspective(fov_height, 4.0/3.0,
+viewer-getCamera()-setProjectionMatrixAsPerspective(fov_height, aspect_ratio,
   fov_near, fov_far);
 }
 
@@ -885,8 +886,9 @@ void FGRenderer::setNearFar( float n, fl
 n = 0.1;
 fov_near = n;
 fov_far = f;
+float aspect_ratio = fgGetDouble(/sim/startup/xsize, 0.0)/fgGetDouble(/sim/startup/ysize, 0.0);
 osgViewer::Viewer* viewer = globals-get_renderer()-getViewer();
-viewer-getCamera()-setProjectionMatrixAsPerspective(fov_height, 4.0/3.0,
+viewer-getCamera()-setProjectionMatrixAsPerspective(fov_height, aspect_ratio,
   fov_near, fov_far);
 }
 
-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/___
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel


Re: [Flightgear-devel] renderer.cxx patch - fix non-4:3 aspect ratio distortion

2008-01-15 Thread dave perry
dave perry wrote:
 Patch fixes the bad assumption in osg fgfs that aspect ratio is always 
 4:3.  I tested all the standard views and also resizing the window.  

The testing done above was with no sdl or osgviewer (just freeglut).  
This works fine.  But with --enable-sdl or with --enable-osgviewer, some 
issues remain.

With renderer.cxx patch and --enable-sdl, the keys !, @, $, %, ^, *, (, 
and ) are recognized only the first time they are depressed.  But no 
distortion of the view including when you drag the window to different 
aspect ratios.

With renderer.cxx patch and --enable-osgviewer, the keys all seem to be 
recognized each depression.  The mouse is verically off-set until you 
resize once so that I had to click below hot spots to get the desired 
event.  Once you maximize or resize the window, this issue is cleared 
up.  But resizing the window still causes some distortion of the image.


 Would someone with cvs submit capability check the patch and then 
 commit it.

 - Dave P.


-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel