[pkg-fgfs-crew] r140 - in /flightgear/trunk: src/Cockpit/hud.cxx src/Cockpit/hud_rwy.cxx src/Cockpit/panel.cxx src/Instrumentation/HUD/HUD.cxx src/Instrumentation/HUD/HUD_runway.cxx utils/Modeller/texture.cxx

ovek at users.alioth.debian.org ovek at users.alioth.debian.org
Thu Jul 21 13:52:56 UTC 2011


Author: ovek
Date: Thu Jul 21 13:52:55 2011
New Revision: 140

URL: http://svn.debian.org/wsvn/pkg-fgfs/?sc=1&rev=140
Log:
Apply upstream commit f901dac2ac598e68e55e0a53de419f173c19bfc6
"replace GLU functions with OSG functionality"

Modified:
    flightgear/trunk/src/Cockpit/hud.cxx
    flightgear/trunk/src/Cockpit/hud_rwy.cxx
    flightgear/trunk/src/Cockpit/panel.cxx
    flightgear/trunk/src/Instrumentation/HUD/HUD.cxx
    flightgear/trunk/src/Instrumentation/HUD/HUD_runway.cxx
    flightgear/trunk/utils/Modeller/texture.cxx

Modified: flightgear/trunk/src/Cockpit/hud.cxx
URL: http://svn.debian.org/wsvn/pkg-fgfs/flightgear/trunk/src/Cockpit/hud.cxx?rev=140&op=diff
==============================================================================
--- flightgear/trunk/src/Cockpit/hud.cxx (original)
+++ flightgear/trunk/src/Cockpit/hud.cxx Thu Jul 21 13:52:55 2011
@@ -40,7 +40,7 @@
 #include <simgear/misc/sg_path.hxx>
 #include <simgear/props/props_io.hxx>
 
-#include <osg/GLU>
+#include <osg/Matrixf>
 
 #include <Aircraft/aircraft.hxx>
 //#include <Autopilot/xmlauto.hxx>
@@ -340,27 +340,31 @@
 
 void fgUpdateHUDVirtual(osg::State* state)
 {
+    using namespace osg;
     FGViewer* view = globals->get_current_view();
 
     // Standard fgfs projection, with essentially meaningless clip
     // planes (we'll map the whole HUD plane to z=-1)
     glMatrixMode(GL_PROJECTION);
     glPushMatrix();
-    glLoadIdentity();
-    gluPerspective(view->get_v_fov(), 1/view->get_aspect_ratio(), 0.1, 10);
+    Matrixf proj
+        = Matrixf::perspective(view->get_v_fov(), 1/view->get_aspect_ratio(),
+                               0.1, 10);
+    glLoadMatrix(proj.ptr());
 
     glMatrixMode(GL_MODELVIEW);
     glPushMatrix();
-    glLoadIdentity();
 
     // Standard fgfs view direction computation
-    float lookat[3];
+    Vec3f lookat;
     lookat[0] = -sin(SG_DEGREES_TO_RADIANS * view->getHeadingOffset_deg());
     lookat[1] = tan(SG_DEGREES_TO_RADIANS * view->getPitchOffset_deg());
     lookat[2] = -cos(SG_DEGREES_TO_RADIANS * view->getHeadingOffset_deg());
     if (fabs(lookat[1]) > 9999)
         lookat[1] = 9999; // FPU sanity
-    gluLookAt(0, 0, 0, lookat[0], lookat[1], lookat[2], 0, 1, 0);
+    Matrixf mv = Matrixf::lookAt(Vec3f(0.0, 0.0, 0.0), lookat,
+                                 Vec3f(0.0, 1.0, 0.0));
+    glLoadMatrix(mv.ptr());
 
     // Map the -1:1 square to a 55.0x41.25 degree wide patch at z=1.
     // This is the default fgfs field of view, which the HUD files are
@@ -393,10 +397,11 @@
 void fgUpdateHUD( osg::State* state, GLfloat x_start, GLfloat y_start,
                   GLfloat x_end, GLfloat y_end )
 {
+    using namespace osg;
     glMatrixMode(GL_PROJECTION);
     glPushMatrix();
-    glLoadIdentity();
-    gluOrtho2D(x_start, x_end, y_start, y_end);
+    Matrixf proj = Matrixf::ortho2D(x_start, x_end, y_start, y_end);
+    glLoadMatrix(proj.ptr());
 
     glMatrixMode(GL_MODELVIEW);
     glPushMatrix();

Modified: flightgear/trunk/src/Cockpit/hud_rwy.cxx
URL: http://svn.debian.org/wsvn/pkg-fgfs/flightgear/trunk/src/Cockpit/hud_rwy.cxx?rev=140&op=diff
==============================================================================
--- flightgear/trunk/src/Cockpit/hud_rwy.cxx (original)
+++ flightgear/trunk/src/Cockpit/hud_rwy.cxx Thu Jul 21 13:52:55 2011
@@ -33,8 +33,7 @@
 #include <ATCDCL/ATCutils.hxx>
 #include <Main/viewer.hxx>
 
-#include <osg/GLU>
-
+#include <simgear/math/project.hxx>
 
 // int x, int y, int width, int height, float scale_data, bool working)
 
@@ -135,8 +134,9 @@
         //Calculate the 2D points via gluProject
         int result = GL_TRUE;
         for (int i = 0; i < 6; i++) {
-            result = gluProject(points3d[i][0], points3d[i][1], points3d[i][2], mm,
-                    pm, view, &points2d[i][0], &points2d[i][1], &points2d[i][2]);
+            result = simgear::project(points3d[i][0], points3d[i][1], points3d[i][2],
+                                      mm, pm, view,
+                                      &points2d[i][0], &points2d[i][1], &points2d[i][2]);
         }
         //set the line width based on our distance from the runway
         setLineWidth();
@@ -240,7 +240,8 @@
         sgdVec3 newPt;
         sgdCopyVec3(newPt, a1);
         sgdAddVec3(newPt, vec);
-        if (gluProject(newPt[0], newPt[1], newPt[2], mm, pm, view, &p2[0], &p2[1], &p2[2])
+        if (simgear::project(newPt[0], newPt[1], newPt[2], mm, pm, view,
+                             &p2[0], &p2[1], &p2[2])
                 && (p2[2] > 0 && p2[2] < 1.0)) {
             boundPoint(p1, p2);
             glBegin(GL_LINES);
@@ -256,7 +257,8 @@
         sgdVec3 newPt;
         sgdCopyVec3(newPt, a2);
         sgdAddVec3(newPt, vec);
-        if (gluProject(newPt[0], newPt[1], newPt[2], mm, pm, view, &p1[0], &p1[1], &p1[2])
+        if (simgear::project(newPt[0], newPt[1], newPt[2], mm, pm, view,
+                             &p1[0], &p1[1], &p1[2])
                 && (p1[2] > 0 && p1[2] < 1.0)) {
             boundPoint(p2, p1);
             glBegin(GL_LINES);

Modified: flightgear/trunk/src/Cockpit/panel.cxx
URL: http://svn.debian.org/wsvn/pkg-fgfs/flightgear/trunk/src/Cockpit/panel.cxx?rev=140&op=diff
==============================================================================
--- flightgear/trunk/src/Cockpit/panel.cxx (original)
+++ flightgear/trunk/src/Cockpit/panel.cxx Thu Jul 21 13:52:55 2011
@@ -40,6 +40,7 @@
 #include <osg/CullFace>
 #include <osg/Depth>
 #include <osg/Material>
+#include <osg/Matrixf>
 #include <osg/TexEnv>
 #include <osg/PolygonOffset>
 
@@ -277,6 +278,7 @@
 void
 FGPanel::update (osg::State& state, GLfloat winx, GLfloat winw, GLfloat winy, GLfloat winh)
 {
+  using namespace osg;
                                // Calculate accelerations
                                // and jiggle the panel accordingly
                                // The factors and bounds are just
@@ -288,12 +290,13 @@
 
   glMatrixMode(GL_PROJECTION);
   glPushMatrix();
-  glLoadIdentity();
+  Matrixf proj;
   if ( _flipx->getBoolValue() ) {
-    gluOrtho2D(winx + winw, winx, winy + winh, winy); /* up side down */
+      proj = Matrixf::ortho2D(winx + winw, winx, winy + winh, winy); /* up side down */
   } else {
-    gluOrtho2D(winx, winx + winw, winy, winy + winh); /* right side up */
-  }
+      proj = Matrixf::ortho2D(winx, winx + winw, winy, winy + winh); /* right side up */
+  }
+  glLoadMatrix(proj.ptr());
   
   glMatrixMode(GL_MODELVIEW);
   glPushMatrix();

Modified: flightgear/trunk/src/Instrumentation/HUD/HUD.cxx
URL: http://svn.debian.org/wsvn/pkg-fgfs/flightgear/trunk/src/Instrumentation/HUD/HUD.cxx?rev=140&op=diff
==============================================================================
--- flightgear/trunk/src/Instrumentation/HUD/HUD.cxx (original)
+++ flightgear/trunk/src/Instrumentation/HUD/HUD.cxx Thu Jul 21 13:52:55 2011
@@ -186,27 +186,31 @@
 
 void HUD::draw3D()
 {
+    using namespace osg;
     FGViewer* view = globals->get_current_view();
 
     // Standard fgfs projection, with essentially meaningless clip
     // planes (we'll map the whole HUD plane to z=-1)
     glMatrixMode(GL_PROJECTION);
     glPushMatrix();
-    glLoadIdentity();
-    gluPerspective(view->get_v_fov(), 1.0 / view->get_aspect_ratio(), 0.1, 10);
+    Matrixf proj
+        = Matrixf::perspective(view->get_v_fov(), 1/view->get_aspect_ratio(),
+                               0.1, 10);
+    glLoadMatrix(proj.ptr());
 
     glMatrixMode(GL_MODELVIEW);
     glPushMatrix();
-    glLoadIdentity();
 
     // Standard fgfs view direction computation
-    float lookat[3];
+    Vec3f lookat;
     lookat[0] = -sin(SG_DEGREES_TO_RADIANS * view->getHeadingOffset_deg());
     lookat[1] = tan(SG_DEGREES_TO_RADIANS * view->getPitchOffset_deg());
     lookat[2] = -cos(SG_DEGREES_TO_RADIANS * view->getHeadingOffset_deg());
     if (fabs(lookat[1]) > 9999)
         lookat[1] = 9999; // FPU sanity
-    gluLookAt(0, 0, 0, lookat[0], lookat[1], lookat[2], 0, 1, 0);
+    Matrixf mv = Matrixf::lookAt(Vec3f(0.0, 0.0, 0.0), lookat,
+                                 Vec3f(0.0, 1.0, 0.0));
+    glLoadMatrix(mv.ptr());
 
     // Map the -1:1 square to a 55.0x41.25 degree wide patch at z=1.
     // This is the default fgfs field of view, which the HUD files are
@@ -236,10 +240,11 @@
 
 void HUD::draw2D(GLfloat x_start, GLfloat y_start, GLfloat x_end, GLfloat y_end)
 {
+    using namespace osg;
     glMatrixMode(GL_PROJECTION);
     glPushMatrix();
-    glLoadIdentity();
-    gluOrtho2D(x_start, x_end, y_start, y_end);
+    Matrixf proj = Matrixf::ortho2D(x_start, x_end, y_start, y_end);
+    glLoadMatrix(proj.ptr());
 
     glMatrixMode(GL_MODELVIEW);
     glPushMatrix();

Modified: flightgear/trunk/src/Instrumentation/HUD/HUD_runway.cxx
URL: http://svn.debian.org/wsvn/pkg-fgfs/flightgear/trunk/src/Instrumentation/HUD/HUD_runway.cxx?rev=140&op=diff
==============================================================================
--- flightgear/trunk/src/Instrumentation/HUD/HUD_runway.cxx (original)
+++ flightgear/trunk/src/Instrumentation/HUD/HUD_runway.cxx Thu Jul 21 13:52:55 2011
@@ -25,7 +25,7 @@
 
 #include <simgear/compiler.h>
 #include <simgear/math/sg_geodesy.hxx>
-#include <osg/GLU>
+#include <simgear/math/project.hxx>
 
 #include <Main/globals.hxx>
 #include <Scenery/scenery.hxx>
@@ -130,8 +130,9 @@
     //Calculate the 2D points via gluProject
     int result = GL_TRUE;
     for (int i = 0; i < 6; i++) {
-        result = gluProject(_points3d[i][0], _points3d[i][1], _points3d[i][2], _mm,
-                _pm, _view, &_points2d[i][0], &_points2d[i][1], &_points2d[i][2]);
+        result = simgear::project(_points3d[i][0], _points3d[i][1], _points3d[i][2],
+                                  _mm, _pm, _view,
+                                  &_points2d[i][0], &_points2d[i][1], &_points2d[i][2]);
     }
     //set the line width based on our distance from the runway
     setLineWidth();
@@ -230,7 +231,8 @@
         sgdVec3 newPt;
         sgdCopyVec3(newPt, a1);
         sgdAddVec3(newPt, vec);
-        if (gluProject(newPt[0], newPt[1], newPt[2], _mm, _pm, _view, &p2[0], &p2[1], &p2[2])
+        if (simgear::project(newPt[0], newPt[1], newPt[2], _mm, _pm, _view,
+                             &p2[0], &p2[1], &p2[2])
                 && (p2[2] > 0 && p2[2] < 1.0)) {
             boundPoint(p1, p2);
             glBegin(GL_LINES);
@@ -246,7 +248,8 @@
         sgdVec3 newPt;
         sgdCopyVec3(newPt, a2);
         sgdAddVec3(newPt, vec);
-        if (gluProject(newPt[0], newPt[1], newPt[2], _mm, _pm, _view, &p1[0], &p1[1], &p1[2])
+        if (simgear::project(newPt[0], newPt[1], newPt[2], _mm, _pm, _view,
+                             &p1[0], &p1[1], &p1[2])
                 && (p1[2] > 0 && p1[2] < 1.0)) {
             boundPoint(p2, p1);
             glBegin(GL_LINES);

Modified: flightgear/trunk/utils/Modeller/texture.cxx
URL: http://svn.debian.org/wsvn/pkg-fgfs/flightgear/trunk/utils/Modeller/texture.cxx?rev=140&op=diff
==============================================================================
--- flightgear/trunk/utils/Modeller/texture.cxx (original)
+++ flightgear/trunk/utils/Modeller/texture.cxx Thu Jul 21 13:52:55 2011
@@ -17,7 +17,7 @@
 # include <windows.h>
 #endif
 
-#include <osg/GLU>
+#include <osg/Matrixf>
 
 #include <math.h>
 #include <zlib.h>
@@ -95,6 +95,7 @@
 void
 SGTexture::resize(unsigned int width, unsigned int height)
 {
+    using namespace osg;
     GLfloat aspect;
 
     // Make sure that we don't get a divide by zero exception
@@ -110,10 +111,10 @@
     // Go to the projection matrix, this gets modified by the perspective
     // calulations
     glMatrixMode(GL_PROJECTION);
-    glLoadIdentity();
 
     // Do the perspective calculations
-    gluPerspective(45.0, aspect, 1.0, 400.0);
+    Matrixf proj = Matrixf::perspective(45.0, aspect, 1.0, 400.0);
+    glLoadMatrix(proj.ptr());
 
     // Return to the modelview matrix
     glMatrixMode(GL_MODELVIEW);




More information about the pkg-fgfs-crew mailing list