]> git.mxchange.org Git - flightgear.git/commitdiff
Add xgl wrappers for debugging.
authorcurt <curt>
Mon, 15 Dec 1997 23:54:25 +0000 (23:54 +0000)
committercurt <curt>
Mon, 15 Dec 1997 23:54:25 +0000 (23:54 +0000)
Generate terrain normals on the fly.

35 files changed:
Aircraft/aircraft.c
Aircraft/depend
Cockpit/cockpit.c
Cockpit/depend
Cockpit/hud.c
Controls/controls.h
Controls/depend
LaRCsim/depend
Main/GLUTkey.c
Main/GLUTmain.c
Main/Makefile
Main/depend
Main/fg_init.c
Main/views.c
Main/views.h
Scenery/astro.c
Scenery/depend
Scenery/mesh.c
Scenery/moon.c
Scenery/obj.c
Scenery/orbits.c
Scenery/scenery.c
Scenery/scenery.h
Scenery/stars.c
Scenery/sun.c
Simulator/Makefile
Simulator/make.inc
Slew/depend
Slew/slew.c
Time/depend
Time/fg_time.c
Time/fg_time.h
Time/sunpos.c
Time/sunpos.h
Weather/depend

index e19a081862afaffb1683142b73661613e7da52cb..097f9608412b85516237c9b8ec1b2eef2e6e7545 100644 (file)
@@ -27,7 +27,7 @@
 #include <stdio.h>
 
 #include "aircraft.h"
-#include "../constants.h"
+#include "../Include/constants.h"
 
 
 /* This is a record containing all the info for the aircraft currently
@@ -53,10 +53,14 @@ void fgAircraftOutputCurrent(struct fgAIRCRAFT *a) {
 
 
 /* $Log$
-/* Revision 1.12  1997/12/10 22:37:37  curt
-/* Prepended "fg" on the name of all global structures that didn't have it yet.
-/* i.e. "struct WEATHER {}" became "struct fgWEATHER {}"
+/* Revision 1.13  1997/12/15 23:54:30  curt
+/* Add xgl wrappers for debugging.
+/* Generate terrain normals on the fly.
 /*
+ * Revision 1.12  1997/12/10 22:37:37  curt
+ * Prepended "fg" on the name of all global structures that didn't have it yet.
+ * i.e. "struct WEATHER {}" became "struct fgWEATHER {}"
+ *
  * Revision 1.11  1997/09/13 02:00:05  curt
  * Mostly working on stars and generating sidereal time for accurate star
  * placement.
index 5de52b7c6e3e0e8871e13a5d6aab0d7844fa16c7..24540f83ca3eee45b7e2421181f0f043e3fce470 100644 (file)
@@ -1,4 +1,4 @@
 aircraft.o: aircraft.c aircraft.h ../Flight/flight.h \
  ../Flight/Slew/slew.h ../Flight/LaRCsim/ls_interface.h \
  ../Flight/LaRCsim/../flight.h ../Controls/controls.h \
- ../Controls/../limits.h ../constants.h
+ ../Controls/../Include/limits.h ../Include/constants.h
index bef2cbf37c76a91d31a33ae84a5661e220d4a61c..93774f5461187fed4ee1fa2c5c2e5afb62ee7b2f 100644 (file)
@@ -29,7 +29,7 @@
 #include <stdlib.h>
 #include "cockpit.h"
 
-#include "../constants.h"
+#include "../Include/constants.h"
 
 #include "../Aircraft/aircraft.h"
 #include "../Scenery/mesh.h"
@@ -87,10 +87,14 @@ void fgCockpitUpdate()
 
 
 /* $Log$
-/* Revision 1.2  1997/12/10 22:37:38  curt
-/* Prepended "fg" on the name of all global structures that didn't have it yet.
-/* i.e. "struct WEATHER {}" became "struct fgWEATHER {}"
+/* Revision 1.3  1997/12/15 23:54:33  curt
+/* Add xgl wrappers for debugging.
+/* Generate terrain normals on the fly.
 /*
+ * Revision 1.2  1997/12/10 22:37:38  curt
+ * Prepended "fg" on the name of all global structures that didn't have it yet.
+ * i.e. "struct WEATHER {}" became "struct fgWEATHER {}"
+ *
  * Revision 1.1  1997/08/29 18:03:20  curt
  * Initial revision.
  *
index a271456de9289405b642c5e1ece4c5cad90bf0dd..1e0cb8cc7878d93aeeec6dfebaf8a3a39f0f799a 100644 (file)
@@ -3,28 +3,28 @@ cockpit.o: cockpit.c cockpit.h hud.h ../Aircraft/aircraft.h \
  ../Aircraft/../Flight/LaRCsim/ls_interface.h \
  ../Aircraft/../Flight/LaRCsim/../flight.h \
  ../Aircraft/../Controls/controls.h \
- ../Aircraft/../Controls/../limits.h ../Flight/flight.h \
- ../Controls/controls.h ../constants.h ../Scenery/mesh.h \
- ../Scenery/scenery.h ../Scenery/../types.h ../Math/mat3.h \
- ../Math/polar.h ../Math/../types.h ../Time/fg_timer.h \
+ ../Aircraft/../Controls/../Include/limits.h ../Flight/flight.h \
+ ../Controls/controls.h ../Include/constants.h ../Scenery/mesh.h \
+ ../Scenery/scenery.h ../Scenery/../Include/types.h ../Math/mat3.h \
+ ../Math/polar.h ../Math/../Include/types.h ../Time/fg_timer.h \
  ../Math/fg_random.h ../Weather/weather.h
 hud.o: hud.c hud.h ../Aircraft/aircraft.h \
  ../Aircraft/../Flight/flight.h ../Aircraft/../Flight/Slew/slew.h \
  ../Aircraft/../Flight/LaRCsim/ls_interface.h \
  ../Aircraft/../Flight/LaRCsim/../flight.h \
  ../Aircraft/../Controls/controls.h \
- ../Aircraft/../Controls/../limits.h ../Flight/flight.h \
- ../Controls/controls.h ../constants.h ../Scenery/mesh.h \
- ../Scenery/scenery.h ../Scenery/../types.h ../Math/mat3.h \
- ../Math/polar.h ../Math/../types.h ../Time/fg_timer.h \
+ ../Aircraft/../Controls/../Include/limits.h ../Flight/flight.h \
+ ../Controls/controls.h ../Include/constants.h ../Scenery/mesh.h \
+ ../Scenery/scenery.h ../Scenery/../Include/types.h ../Math/mat3.h \
+ ../Math/polar.h ../Math/../Include/types.h ../Time/fg_timer.h \
  ../Math/fg_random.h ../Weather/weather.h
 test.o: test.c test.h ../Aircraft/aircraft.h \
  ../Aircraft/../Flight/flight.h ../Aircraft/../Flight/Slew/slew.h \
  ../Aircraft/../Flight/LaRCsim/ls_interface.h \
  ../Aircraft/../Flight/LaRCsim/../flight.h \
  ../Aircraft/../Controls/controls.h \
- ../Aircraft/../Controls/../limits.h ../Flight/flight.h \
- ../Controls/controls.h ../constants.h ../Scenery/mesh.h \
- ../Scenery/scenery.h ../Scenery/../types.h ../Math/mat3.h \
- ../Math/polar.h ../Math/../types.h ../Time/fg_timer.h \
+ ../Aircraft/../Controls/../Include/limits.h ../Flight/flight.h \
+ ../Controls/controls.h ../Include/constants.h ../Scenery/mesh.h \
+ ../Scenery/scenery.h ../Scenery/../Include/types.h ../Math/mat3.h \
+ ../Math/polar.h ../Math/../Include/types.h ../Time/fg_timer.h \
  ../Math/fg_random.h ../Weather/weather.h
index 37bf6d4a0ee712581edea880aee63b1bc1507c16..ce189c1d36a63aed3cc432ffd14599e11b4b253b 100644 (file)
@@ -31,7 +31,7 @@
 #endif /* not WIN32 */
 #include "hud.h"
 
-#include "../constants.h"
+#include "../Include/constants.h"
 
 #include "../Aircraft/aircraft.h"
 #include "../Scenery/mesh.h"
@@ -807,10 +807,14 @@ void fgUpdateHUD( Hptr hud )
 
 
 /* $Log$
-/* Revision 1.5  1997/12/10 22:37:39  curt
-/* Prepended "fg" on the name of all global structures that didn't have it yet.
-/* i.e. "struct WEATHER {}" became "struct fgWEATHER {}"
+/* Revision 1.6  1997/12/15 23:54:34  curt
+/* Add xgl wrappers for debugging.
+/* Generate terrain normals on the fly.
 /*
+ * Revision 1.5  1997/12/10 22:37:39  curt
+ * Prepended "fg" on the name of all global structures that didn't have it yet.
+ * i.e. "struct WEATHER {}" became "struct fgWEATHER {}"
+ *
  * Revision 1.4  1997/09/23 00:29:32  curt
  * Tweaks to get things to compile with gcc-win32.
  *
index cf4b8a6a61d092e50d1329cb56addf6650ca3f99..6a03028eb3f52c499d53ee2fc5436cfeae4b5afa 100644 (file)
@@ -28,7 +28,7 @@
 #define CONTROLS_H
 
 
-#include "../limits.h"
+#include "../Include/limits.h"
 
 
 /* Define a structure containing the control parameters */
@@ -81,10 +81,14 @@ void fgThrottleSet(int engine, double pos);
 
 
 /* $Log$
-/* Revision 1.6  1997/12/10 22:37:41  curt
-/* Prepended "fg" on the name of all global structures that didn't have it yet.
-/* i.e. "struct WEATHER {}" became "struct fgWEATHER {}"
+/* Revision 1.7  1997/12/15 23:54:36  curt
+/* Add xgl wrappers for debugging.
+/* Generate terrain normals on the fly.
 /*
+ * Revision 1.6  1997/12/10 22:37:41  curt
+ * Prepended "fg" on the name of all global structures that didn't have it yet.
+ * i.e. "struct WEATHER {}" became "struct fgWEATHER {}"
+ *
  * Revision 1.5  1997/08/27 03:30:02  curt
  * Changed naming scheme of basic shared structures.
  *
index b3cba7d645ea1859cdf4c5ab95f520f44a50c498..2500b06dcf849058ad34810068165b1a3dc74e31 100644 (file)
@@ -1,5 +1,6 @@
-controls.o: controls.c controls.h ../limits.h ../Aircraft/aircraft.h \
- ../Aircraft/../Flight/flight.h ../Aircraft/../Flight/Slew/slew.h \
+controls.o: controls.c controls.h ../Include/limits.h \
+ ../Aircraft/aircraft.h ../Aircraft/../Flight/flight.h \
+ ../Aircraft/../Flight/Slew/slew.h \
  ../Aircraft/../Flight/LaRCsim/ls_interface.h \
  ../Aircraft/../Flight/LaRCsim/../flight.h \
  ../Aircraft/../Controls/controls.h
index 6a3fc39dc50353a0734e3e6050bacc52247d1adf..b38be84dd41dcbc5ad3e272300cc9062d9394c30 100644 (file)
@@ -12,7 +12,7 @@ ls_interface.o: ls_interface.c ls_types.h ls_constants.h ls_generic.h \
  ../Slew/slew.h ../LaRCsim/ls_interface.h ../../Aircraft/aircraft.h \
  ../../Aircraft/../Flight/flight.h \
  ../../Aircraft/../Controls/controls.h \
- ../../Aircraft/../Controls/../limits.h
+ ../../Aircraft/../Controls/../Include/limits.h
 ls_model.o: ls_model.c ls_types.h
 ls_step.o: ls_step.c ls_types.h ls_constants.h ls_generic.h
 ls_sync.o: ls_sync.c ls_types.h ls_sim_control.h
index 22442cb866cbb73bfeb124937c67c1f492a29450..66f139b75b3fbeb6c0ab93bab86e30cd11108502 100644 (file)
 #endif
 
 #include <GL/glut.h>
+#include "../XGL/xgl.h"
 #include <stdio.h>
 
 #include "GLUTkey.h"
 #include "views.h"
 
-#include "../constants.h"
+#include "../Include/constants.h"
 
 #include "../Aircraft/aircraft.h"
 #include "../Weather/weather.h"
@@ -87,7 +88,7 @@ void GLUTkey(unsigned char k, int x, int y) {
            return;
        case 90: /* Z key */
            w->visibility /= 1.10;
-           glFogf(GL_FOG_END, w->visibility);
+           xglFogf(GL_FOG_END, w->visibility);
            printf("Fog density = %.4f\n", w->visibility);
            return;
        }
@@ -131,7 +132,7 @@ void GLUTkey(unsigned char k, int x, int y) {
            return;
        case 122: /* z key */
            w->visibility *= 1.10;
-           glFogf(GL_FOG_END, w->visibility);
+           xglFogf(GL_FOG_END, w->visibility);
            printf("Fog density = %.4f\n", w->visibility);
            return;
        case 27: /* ESC */
@@ -224,10 +225,14 @@ void GLUTspecialkey(int k, int x, int y) {
 
 
 /* $Log$
-/* Revision 1.22  1997/12/10 22:37:45  curt
-/* Prepended "fg" on the name of all global structures that didn't have it yet.
-/* i.e. "struct WEATHER {}" became "struct fgWEATHER {}"
+/* Revision 1.23  1997/12/15 23:54:44  curt
+/* Add xgl wrappers for debugging.
+/* Generate terrain normals on the fly.
 /*
+ * Revision 1.22  1997/12/10 22:37:45  curt
+ * Prepended "fg" on the name of all global structures that didn't have it yet.
+ * i.e. "struct WEATHER {}" became "struct fgWEATHER {}"
+ *
  * Revision 1.21  1997/08/27 21:32:23  curt
  * Restructured view calculation code.  Added stars.
  *
index 7f74979f6a81e1d25b8dffc10b57ae308c15f75a..da730f6d4f9862606cc57516ec86eacf53b03b53 100644 (file)
 #endif
 
 #include <GL/glut.h>
+#include "../XGL/xgl.h"
 #include <stdio.h>
 
 #include "GLUTkey.h"
 #include "fg_init.h"
 #include "views.h"
 
-#include "../constants.h"
-#include "../general.h"
+#include "../Include/constants.h"
+#include "../Include/general.h"
 
 #include "../Aircraft/aircraft.h"
 #include "../Cockpit/cockpit.h"
@@ -87,32 +88,32 @@ static void fgInitVisuals() {
     t = &cur_time_params;
     w = &current_weather;
 
-    glEnable( GL_DEPTH_TEST );
-    /* glFrontFace(GL_CW); */
-    glEnable( GL_CULL_FACE );
+    xglEnable( GL_DEPTH_TEST );
+    /* xglFrontFace(GL_CW); */
+    xglEnable( GL_CULL_FACE );
     
-    /* glDisable( GL_DITHER ); */
+    /* xglDisable( GL_DITHER ); */
 
     /* If enabled, normal vectors specified with glNormal are scaled
        to unit length after transformation.  See glNormal. */
-    glEnable( GL_NORMALIZE );
+    xglEnable( GL_NORMALIZE );
 
-    glEnable( GL_LIGHTING );
-    glEnable( GL_LIGHT0 );
-    glLightfv( GL_LIGHT0, GL_POSITION, l->sun_vec );
+    xglEnable( GL_LIGHTING );
+    xglEnable( GL_LIGHT0 );
+    xglLightfv( GL_LIGHT0, GL_POSITION, l->sun_vec );
 
-    glShadeModel( GL_FLAT ); /* glShadeModel( GL_SMOOTH ); */
+    xglShadeModel( GL_FLAT ); /* xglShadeModel( GL_SMOOTH ); */
 
-    glEnable( GL_FOG );
-    glFogi (GL_FOG_MODE, GL_LINEAR);
-    /* glFogf (GL_FOG_START, 1.0); */
-    glFogf (GL_FOG_END, w->visibility);
-    glFogfv (GL_FOG_COLOR, fgFogColor);
-    /* glFogf (GL_FOG_DENSITY, w->visibility); */
-    /* glHint (GL_FOG_HINT, GL_FASTEST); */
+    xglEnable( GL_FOG );
+    xglFogi (GL_FOG_MODE, GL_LINEAR);
+    /* xglFogf (GL_FOG_START, 1.0); */
+    xglFogf (GL_FOG_END, w->visibility);
+    xglFogfv (GL_FOG_COLOR, fgFogColor);
+    /* xglFogf (GL_FOG_DENSITY, w->visibility); */
+    /* xglHint (GL_FOG_HINT, GL_FASTEST); */
 
     /* initial screen color */
-    glClearColor(0.0, 0.0, 0.0, 1.0);
+    xglClearColor(0.0, 0.0, 0.0, 1.0);
 }
 
 
@@ -141,22 +142,22 @@ static void fgUpdateViewParams() {
     fgViewUpdate(f, v);
 
     /* Tell GL we are about to modify the projection parameters */
-    glMatrixMode(GL_PROJECTION);
-    glLoadIdentity();
+    xglMatrixMode(GL_PROJECTION);
+    xglLoadIdentity();
     gluPerspective(55.0, 1.0/win_ratio, 1.0, 200000.0);
 
-    glMatrixMode(GL_MODELVIEW);
-    glLoadIdentity();
+    xglMatrixMode(GL_MODELVIEW);
+    xglLoadIdentity();
     
     /* set up our view volume */
     gluLookAt(v->view_pos.x, v->view_pos.y, v->view_pos.z,
-             v->view_pos.x + v->view_forward[0], 
-             v->view_pos.y + v->view_forward[1], 
-             v->view_pos.z + v->view_forward[2],
-             v->view_up[0], v->view_up[1], v->view_up[2]);
+              v->view_pos.x + v->view_forward[0], 
+              v->view_pos.y + v->view_forward[1], 
+              v->view_pos.z + v->view_forward[2],
+              v->view_up[0], v->view_up[1], v->view_up[2]);
 
     /* set the sun position */
-    glLightfv( GL_LIGHT0, GL_POSITION, l->sun_vec );
+    xglLightfv( GL_LIGHT0, GL_POSITION, l->sun_vec );
 
     /* calculate lighting parameters based on sun's relative angle to
      * local up */
@@ -190,15 +191,15 @@ static void fgUpdateViewParams() {
     l->scene_diffuse[2] = white[2] * diffuse;
 
     /* set lighting parameters */
-    glLightfv(GL_LIGHT0, GL_AMBIENT, l->scene_ambient );
-    glLightfv(GL_LIGHT0, GL_DIFFUSE, l->scene_diffuse );
+    xglLightfv(GL_LIGHT0, GL_AMBIENT, l->scene_ambient );
+    xglLightfv(GL_LIGHT0, GL_DIFFUSE, l->scene_diffuse );
 
     /* set fog color */
     l->scene_fog[0] = fgFogColor[0] * (ambient + diffuse);
     l->scene_fog[1] = fgFogColor[1] * (ambient + diffuse);
     l->scene_fog[2] = fgFogColor[2] * (ambient + diffuse);
     l->scene_fog[3] = fgFogColor[3];
-    glFogfv (GL_FOG_COLOR, l->scene_fog);
+    xglFogfv (GL_FOG_COLOR, l->scene_fog);
 
     /* set sky color */
     l->scene_clear[0] = sky_color[0] * sky_brightness;
@@ -206,8 +207,8 @@ static void fgUpdateViewParams() {
     l->scene_clear[2] = sky_color[2] * sky_brightness;
     l->scene_clear[3] = sky_color[3];
 
-    glClearColor(l->scene_clear[0], l->scene_clear[1], 
-                l->scene_clear[2], l->scene_clear[3]);
+    xglClearColor(l->scene_clear[0], l->scene_clear[1], 
+                 l->scene_clear[2], l->scene_clear[3]);
 }
 
 
@@ -219,11 +220,11 @@ static void fgUpdateVisuals( void ) {
     /* update view volume parameters */
     fgUpdateViewParams();
 
-    glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
+    xglClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
 
     /* Tell GL we are switching to model view parameters */
-    glMatrixMode(GL_MODELVIEW);
-    /* glLoadIdentity(); */
+    xglMatrixMode(GL_MODELVIEW);
+    /* xglLoadIdentity(); */
 
     /* draw scenery */
     fgSceneryRender();
@@ -236,7 +237,7 @@ static void fgUpdateVisuals( void ) {
        fgCockpitUpdate();
 
     #ifdef GLUT
-      glutSwapBuffers();
+      xglutSwapBuffers();
     #endif
 }
 
@@ -335,38 +336,38 @@ void fgInitTimeDepCalcs() {
     int num_lines = 16;
     float line_len, line_width_2, cur_pos;
 
-    runway = glGenLists(1);
-    glNewList(runway, GL_COMPILE);
+    runway = xglGenLists(1);
+    xglNewList(runway, GL_COMPILE);
     */
     /* draw concrete */
-/*    glBegin(GL_POLYGON);
-    glMaterialfv( GL_FRONT, GL_AMBIENT_AND_DIFFUSE, concrete );
-    glNormal3f(0.0, 0.0, 1.0);
-
-    glVertex3d( 0.0,   -width/2.0, 0.0);
-    glVertex3d( 0.0,    width/2.0, 0.0);
-    glVertex3d(length,  width/2.0, 0.0);
-    glVertex3d(length, -width/2.0, 0.0);
-    glEnd();
+/*    xglBegin(GL_POLYGON);
+    xglMaterialfv( GL_FRONT, GL_AMBIENT_AND_DIFFUSE, concrete );
+    xglNormal3f(0.0, 0.0, 1.0);
+
+    xglVertex3d( 0.0,   -width/2.0, 0.0);
+    xglVertex3d( 0.0,    width/2.0, 0.0);
+    xglVertex3d(length,  width/2.0, 0.0);
+    xglVertex3d(length, -width/2.0, 0.0);
+    xglEnd();
     */
     /* draw center line */
-/*    glMaterialfv( GL_FRONT, GL_AMBIENT_AND_DIFFUSE, line );
+/*    xglMaterialfv( GL_FRONT, GL_AMBIENT_AND_DIFFUSE, line );
     line_len = length / ( 2 * num_lines + 1);
     printf("line_len = %.3f\n", line_len);
     line_width_2 = 0.02;
     cur_pos = line_len;
     for ( i = 0; i < num_lines; i++ ) {
-       glBegin(GL_POLYGON);
-       glVertex3d( cur_pos, -line_width_2, 0.005);
-       glVertex3d( cur_pos,  line_width_2, 0.005);
+       xglBegin(GL_POLYGON);
+       xglVertex3d( cur_pos, -line_width_2, 0.005);
+       xglVertex3d( cur_pos,  line_width_2, 0.005);
        cur_pos += line_len;
-       glVertex3d( cur_pos,  line_width_2, 0.005);
-       glVertex3d( cur_pos, -line_width_2, 0.005);
+       xglVertex3d( cur_pos,  line_width_2, 0.005);
+       xglVertex3d( cur_pos, -line_width_2, 0.005);
        cur_pos += line_len;
-       glEnd();
+       xglEnd();
     }
 
-    glEndList();
+    xglEndList();
 
     return(runway);
 }
@@ -376,17 +377,17 @@ void fgInitTimeDepCalcs() {
 /*static void fgSceneryDraw_OLD() {
     static float z = 32.35;
 
-    glPushMatrix();
+    xglPushMatrix();
 
-    glCallList(scenery);
+    xglCallList(scenery);
 
     printf("*** Drawing runway at %.2f\n", z);
 
-    glTranslatef( -398391.28, 120070.41, 32.35);
-    glRotatef(170.0, 0.0, 0.0, 1.0);
-    glCallList(runway);
+    xglTranslatef( -398391.28, 120070.41, 32.35);
+    xglRotatef(170.0, 0.0, 0.0, 1.0);
+    xglCallList(runway);
 
-    glPopMatrix();
+    xglPopMatrix();
 }
 */
 
@@ -475,11 +476,11 @@ static void fgReshape( int width, int height ) {
     }
 
     /* Inform gl of our view window size */
-    glViewport(0, 0, (GLint)width, (GLint)height);
+    xglViewport(0, 0, (GLint)width, (GLint)height);
 
     fgUpdateViewParams();
     
-    glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
+    xglClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
 }
 
 
@@ -500,16 +501,16 @@ int main( int argc, char *argv[] ) {
 
     #ifdef GLUT
       /* initialize GLUT */
-      glutInit(&argc, argv);
+      xglutInit(&argc, argv);
 
       /* Define Display Parameters */
-      glutInitDisplayMode( GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE );
+      xglutInitDisplayMode( GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE );
 
       /* Define initial window size */
-      glutInitWindowSize(640, 480);
+      xglutInitWindowSize(640, 480);
 
       /* Initialize windows */
-      glutCreateWindow("Flight Gear");
+      xglutCreateWindow("Flight Gear");
     #endif
 
     /* This is the general house keeping init routine */
@@ -536,17 +537,17 @@ int main( int argc, char *argv[] ) {
 
     #ifdef GLUT
       /* call fgReshape() on window resizes */
-      glutReshapeFunc( fgReshape );
+      xglutReshapeFunc( fgReshape );
 
       /* call key() on keyboard event */
-      glutKeyboardFunc( GLUTkey );
+      xglutKeyboardFunc( GLUTkey );
       glutSpecialFunc( GLUTspecialkey );
 
       /* call fgMainLoop() whenever there is nothing else to do */
-      glutIdleFunc( fgMainLoop );
+      xglutIdleFunc( fgMainLoop );
 
       /* draw the scene */
-      glutDisplayFunc( fgUpdateVisuals );
+      xglutDisplayFunc( fgUpdateVisuals );
 
       /* pass control off to the GLUT event handler */
       glutMainLoop();
@@ -564,9 +565,13 @@ int main( int argc, char *argv[] ) {
 
 
 /* $Log$
-/* Revision 1.32  1997/12/15 20:59:08  curt
-/* Misc. tweaks.
+/* Revision 1.33  1997/12/15 23:54:45  curt
+/* Add xgl wrappers for debugging.
+/* Generate terrain normals on the fly.
 /*
+ * Revision 1.32  1997/12/15 20:59:08  curt
+ * Misc. tweaks.
+ *
  * Revision 1.31  1997/12/12 21:41:25  curt
  * More light/material property tweaking ... still a ways off.
  *
index 2a0d40dae30a399badf5dc0bc635fbafd97c47c0..d1a06e1589c8da852d5d1a125e395fa37fe53dc0 100644 (file)
@@ -30,14 +30,14 @@ AFILES = ../Aircraft/libAircraft.a ../Cockpit/libCockpit.a \
        ../Controls/libControls.a ../Flight/libFlight.a \
        ../Joystick/libJoystick.a ../Flight/LaRCsim/libLaRCsim.a \
        ../Flight/Slew/libSlew.a ../Scenery/libScenery.a \
-       ../Time/libTime.a ../Weather/libWeather.a ../Math/libMath.a
+       ../Time/libTime.a ../Weather/libWeather.a ../Math/libMath.a \
 
 
 include ../make.inc
 
 
 CFLAGS = $(FG_CFLAGS) $(INTERFACE_FLAGS)
-LIBS =  $(INTERFACE_LIBS) $(GRAPHICS_LIBS) -lm -lfl
+LIBS =  $(FG_DEBUG_LIBS) $(INTERFACE_LIBS) $(GRAPHICS_LIBS) -lm -lfl
 
 
 TARGET=fg-$(FG_VERSION)
@@ -83,6 +83,10 @@ views.o:
 
 #---------------------------------------------------------------------------
 # $Log$
+# Revision 1.38  1997/12/15 23:54:47  curt
+# Add xgl wrappers for debugging.
+# Generate terrain normals on the fly.
+#
 # Revision 1.37  1997/12/12 21:41:26  curt
 # More light/material property tweaking ... still a ways off.
 #
index 448926188da488ccfcc6babf0d14ab0df5bc6f4d..0fac299af1f1f4eaa2228a41661814b1334ca72d 100644 (file)
@@ -1,36 +1,39 @@
-GLUTkey.o: GLUTkey.c GLUTkey.h views.h ../types.h ../Flight/flight.h \
- ../Flight/Slew/slew.h ../Flight/LaRCsim/ls_interface.h \
- ../Flight/LaRCsim/../flight.h ../Math/mat3.h ../constants.h \
- ../Aircraft/aircraft.h ../Aircraft/../Flight/flight.h \
- ../Aircraft/../Controls/controls.h \
- ../Aircraft/../Controls/../limits.h ../Weather/weather.h
-GLUTmain.o: GLUTmain.c GLUTkey.h fg_init.h views.h ../types.h \
+GLUTkey.o: GLUTkey.c GLUTkey.h views.h ../Include/types.h \
  ../Flight/flight.h ../Flight/Slew/slew.h \
  ../Flight/LaRCsim/ls_interface.h ../Flight/LaRCsim/../flight.h \
- ../Math/mat3.h ../constants.h ../general.h ../Aircraft/aircraft.h \
+ ../Math/mat3.h ../Include/constants.h ../Aircraft/aircraft.h \
  ../Aircraft/../Flight/flight.h ../Aircraft/../Controls/controls.h \
- ../Aircraft/../Controls/../limits.h ../Cockpit/cockpit.h \
+ ../Aircraft/../Controls/../Include/limits.h ../Weather/weather.h
+GLUTmain.o: GLUTmain.c GLUTkey.h fg_init.h views.h ../Include/types.h \
+ ../Flight/flight.h ../Flight/Slew/slew.h \
+ ../Flight/LaRCsim/ls_interface.h ../Flight/LaRCsim/../flight.h \
+ ../Math/mat3.h ../Include/constants.h ../Include/general.h \
+ ../Aircraft/aircraft.h ../Aircraft/../Flight/flight.h \
+ ../Aircraft/../Controls/controls.h \
+ ../Aircraft/../Controls/../Include/limits.h ../Cockpit/cockpit.h \
  ../Cockpit/hud.h ../Cockpit/../Aircraft/aircraft.h \
  ../Cockpit/../Flight/flight.h ../Cockpit/../Controls/controls.h \
  ../Joystick/joystick.h ../Math/fg_geodesy.h ../Math/polar.h \
- ../Math/../types.h ../Scenery/mesh.h ../Scenery/scenery.h \
- ../Scenery/../types.h ../Time/fg_time.h ../Time/../types.h \
- ../Time/../Flight/flight.h ../Time/fg_timer.h ../Time/sunpos.h \
- ../Weather/weather.h
-fg_init.o: fg_init.c fg_init.h views.h ../types.h ../Flight/flight.h \
- ../Flight/Slew/slew.h ../Flight/LaRCsim/ls_interface.h \
- ../Flight/LaRCsim/../flight.h ../Math/mat3.h ../constants.h \
- ../general.h ../Aircraft/aircraft.h ../Aircraft/../Flight/flight.h \
+ ../Math/../Include/types.h ../Scenery/mesh.h ../Scenery/scenery.h \
+ ../Scenery/../Include/types.h ../Time/fg_time.h \
+ ../Time/../Include/types.h ../Time/../Flight/flight.h \
+ ../Time/fg_timer.h ../Time/sunpos.h ../Weather/weather.h
+fg_init.o: fg_init.c fg_init.h views.h ../Include/types.h \
+ ../Flight/flight.h ../Flight/Slew/slew.h \
+ ../Flight/LaRCsim/ls_interface.h ../Flight/LaRCsim/../flight.h \
+ ../Math/mat3.h ../Include/constants.h ../Include/general.h \
+ ../Aircraft/aircraft.h ../Aircraft/../Flight/flight.h \
  ../Aircraft/../Controls/controls.h \
- ../Aircraft/../Controls/../limits.h ../Cockpit/cockpit.h \
+ ../Aircraft/../Controls/../Include/limits.h ../Cockpit/cockpit.h \
  ../Cockpit/hud.h ../Cockpit/../Aircraft/aircraft.h \
  ../Cockpit/../Flight/flight.h ../Cockpit/../Controls/controls.h \
  ../Joystick/joystick.h ../Math/fg_random.h ../Scenery/mesh.h \
  ../Scenery/astro.h ../Scenery/stars.h ../Scenery/scenery.h \
- ../Scenery/../types.h ../Time/fg_time.h ../Time/../types.h \
- ../Time/../Flight/flight.h ../Time/sunpos.h ../Weather/weather.h
-views.o: views.c views.h ../types.h ../Flight/flight.h \
+ ../Scenery/../Include/types.h ../Time/fg_time.h \
+ ../Time/../Include/types.h ../Time/../Flight/flight.h \
+ ../Time/sunpos.h ../Weather/weather.h
+views.o: views.c views.h ../Include/types.h ../Flight/flight.h \
  ../Flight/Slew/slew.h ../Flight/LaRCsim/ls_interface.h \
- ../Flight/LaRCsim/../flight.h ../Math/mat3.h ../constants.h \
- ../Math/polar.h ../Math/../types.h ../Scenery/scenery.h \
- ../Scenery/../types.h
+ ../Flight/LaRCsim/../flight.h ../Math/mat3.h ../Include/constants.h \
+ ../Math/polar.h ../Math/../Include/types.h ../Scenery/scenery.h \
+ ../Scenery/../Include/types.h
index afbc2fb87da663a209b9fc16ea8f37f57dae336c..7edcb27cee2dd4c5c189324f9cb1c9ebd92d132c 100644 (file)
@@ -30,8 +30,8 @@
 #include "fg_init.h"
 #include "views.h"
 
-#include "../constants.h"
-#include "../general.h"
+#include "../Include/constants.h"
+#include "../Include/general.h"
 
 #include "../Aircraft/aircraft.h"
 #include "../Cockpit/cockpit.h"
@@ -218,9 +218,13 @@ void fgInitSubsystems( void ) {
 
 
 /* $Log$
-/* Revision 1.17  1997/12/15 20:59:09  curt
-/* Misc. tweaks.
+/* Revision 1.18  1997/12/15 23:54:49  curt
+/* Add xgl wrappers for debugging.
+/* Generate terrain normals on the fly.
 /*
+ * Revision 1.17  1997/12/15 20:59:09  curt
+ * Misc. tweaks.
+ *
  * Revision 1.16  1997/12/12 19:52:48  curt
  * Working on lightling and material properties.
  *
index 91ec516854b583bf5c1886718418ebe9ac7bcd5a..96cdc71bff28b99b6149cfb7671ac398fdbf636a 100644 (file)
@@ -26,7 +26,7 @@
 
 #include "views.h"
 
-#include "../constants.h"
+#include "../Include/constants.h"
 
 #include "../Flight/flight.h"
 #include "../Math/mat3.h"
@@ -133,10 +133,14 @@ void fgViewUpdate(struct fgFLIGHT *f, struct fgVIEW *v) {
 
 
 /* $Log$
-/* Revision 1.2  1997/12/10 22:37:48  curt
-/* Prepended "fg" on the name of all global structures that didn't have it yet.
-/* i.e. "struct WEATHER {}" became "struct fgWEATHER {}"
+/* Revision 1.3  1997/12/15 23:54:50  curt
+/* Add xgl wrappers for debugging.
+/* Generate terrain normals on the fly.
 /*
+ * Revision 1.2  1997/12/10 22:37:48  curt
+ * Prepended "fg" on the name of all global structures that didn't have it yet.
+ * i.e. "struct WEATHER {}" became "struct fgWEATHER {}"
+ *
  * Revision 1.1  1997/08/27 21:31:17  curt
  * Initial revision.
  *
index 6df74ec5f6a0397b212ca0551a5b56e85dc69fd0..9dc0bfff4e3f3dcc542dbf6dc49ecfee07dbfc40 100644 (file)
@@ -28,7 +28,7 @@
 #define VIEWS_H
 
 
-#include "../types.h"
+#include "../Include/types.h"
 #include "../Flight/flight.h"
 #include "../Math/mat3.h"
 
@@ -55,10 +55,14 @@ void fgViewUpdate(struct fgFLIGHT *f, struct fgVIEW *v);
 
 
 /* $Log$
-/* Revision 1.2  1997/12/10 22:37:48  curt
-/* Prepended "fg" on the name of all global structures that didn't have it yet.
-/* i.e. "struct WEATHER {}" became "struct fgWEATHER {}"
+/* Revision 1.3  1997/12/15 23:54:51  curt
+/* Add xgl wrappers for debugging.
+/* Generate terrain normals on the fly.
 /*
+ * Revision 1.2  1997/12/10 22:37:48  curt
+ * Prepended "fg" on the name of all global structures that didn't have it yet.
+ * i.e. "struct WEATHER {}" became "struct fgWEATHER {}"
+ *
  * Revision 1.1  1997/08/27 21:31:18  curt
  * Initial revision.
  *
index 6bd4e0d2cc92310faab0cb68187bd153ea9167ff..411fd6b1493aef8aa57557446476c9a48e0693a5 100644 (file)
@@ -29,6 +29,7 @@
 #include <time.h>
 
 #include <GL/glut.h>
+#include "../XGL/xgl.h"
 
 #include "astro.h"
 #include "moon.h"
@@ -37,8 +38,8 @@
 #include "stars.h"
 #include "sun.h"
 
-#include "../constants.h"
-#include "../general.h"
+#include "../Include/constants.h"
+#include "../Include/general.h"
 
 #include "../Main/views.h"
 #include "../Aircraft/aircraft.h"
@@ -87,22 +88,22 @@ void fgAstroRender() {
     }
 
     /* Disable fog effects */
-    glDisable( GL_FOG );
+    xglDisable( GL_FOG );
 
     /* set the sun position */
-    glLightfv( GL_LIGHT0, GL_POSITION, l->sun_vec_inv );
+    xglLightfv( GL_LIGHT0, GL_POSITION, l->sun_vec_inv );
 
-    glPushMatrix();
+    xglPushMatrix();
 
     /* Translate to view position */
-    glTranslatef( v->view_pos.x, v->view_pos.y, v->view_pos.z );
+    xglTranslatef( v->view_pos.x, v->view_pos.y, v->view_pos.z );
 
     /* Rotate based on gst (side real time) */
     angle = t->gst * 15.041085; /* should be 15.041085, Curt thought it was 15*/
 #ifdef DEBUG
     printf("Rotating astro objects by %.2f degrees\n",angle);
 #endif
-    glRotatef( angle, 0.0, 0.0, -1.0 );
+    xglRotatef( angle, 0.0, 0.0, -1.0 );
 
     /* render the moon */
     fgMoonRender();
@@ -113,17 +114,21 @@ void fgAstroRender() {
     /* render the sun */
     fgSunRender();
 
-    glPopMatrix();
+    xglPopMatrix();
 
     /* reenable fog effects */
-    glEnable( GL_FOG );
+    xglEnable( GL_FOG );
 }
 
 
 /* $Log$
-/* Revision 1.7  1997/12/15 20:59:09  curt
-/* Misc. tweaks.
+/* Revision 1.8  1997/12/15 23:54:57  curt
+/* Add xgl wrappers for debugging.
+/* Generate terrain normals on the fly.
 /*
+ * Revision 1.7  1997/12/15 20:59:09  curt
+ * Misc. tweaks.
+ *
  * Revision 1.6  1997/12/12 21:41:27  curt
  * More light/material property tweaking ... still a ways off.
  *
index 38498f397dec7ef29f25278f4e6153f144182ef7..86a0234756414375341dd291abf15e9044fa52a6 100644 (file)
@@ -1,46 +1,48 @@
 astro.o: astro.c astro.h stars.h moon.h orbits.h ../Time/fg_time.h \
- ../Time/../types.h ../Time/../Flight/flight.h \
+ ../Time/../Include/types.h ../Time/../Flight/flight.h \
  ../Time/../Flight/Slew/slew.h \
  ../Time/../Flight/LaRCsim/ls_interface.h \
- ../Time/../Flight/LaRCsim/../flight.h planets.h sun.h ../constants.h \
- ../general.h ../Main/views.h ../Main/../types.h \
- ../Main/../Flight/flight.h ../Main/../Math/mat3.h \
- ../Aircraft/aircraft.h ../Aircraft/../Flight/flight.h \
- ../Aircraft/../Controls/controls.h \
- ../Aircraft/../Controls/../limits.h
+ ../Time/../Flight/LaRCsim/../flight.h planets.h sun.h \
+ ../Include/constants.h ../Include/general.h ../Main/views.h \
+ ../Main/../Include/types.h ../Main/../Flight/flight.h \
+ ../Main/../Math/mat3.h ../Aircraft/aircraft.h \
+ ../Aircraft/../Flight/flight.h ../Aircraft/../Controls/controls.h \
+ ../Aircraft/../Controls/../Include/limits.h
 common.o: common.c common.h
 geometry.o: geometry.c geometry.h mesh.h
-mesh.o: mesh.c ../constants.h ../types.h ../Math/fg_geodesy.h \
- ../Math/fg_random.h ../Math/mat3.h ../Math/polar.h ../Math/../types.h \
- mesh.h common.h scenery.h
-moon.o: moon.c orbits.h ../Time/fg_time.h ../Time/../types.h \
+mesh.o: mesh.c ../Include/constants.h ../Include/types.h \
+ ../Math/fg_geodesy.h ../Math/fg_random.h ../Math/mat3.h \
../Math/polar.h ../Math/../Include/types.h mesh.h common.h scenery.h
+moon.o: moon.c orbits.h ../Time/fg_time.h ../Time/../Include/types.h \
  ../Time/../Flight/flight.h ../Time/../Flight/Slew/slew.h \
  ../Time/../Flight/LaRCsim/ls_interface.h \
- ../Time/../Flight/LaRCsim/../flight.h moon.h ../general.h \
- ../Main/views.h ../Main/../types.h ../Main/../Flight/flight.h \
+ ../Time/../Flight/LaRCsim/../flight.h moon.h ../Include/general.h \
+ ../Main/views.h ../Main/../Include/types.h ../Main/../Flight/flight.h \
  ../Main/../Math/mat3.h
-obj.o: obj.c obj.h scenery.h ../types.h ../Math/mat3.h
-orbits.o: orbits.c orbits.h ../Time/fg_time.h ../Time/../types.h \
- ../Time/../Flight/flight.h ../Time/../Flight/Slew/slew.h \
+obj.o: obj.c obj.h scenery.h ../Include/types.h ../Math/mat3.h
+orbits.o: orbits.c orbits.h ../Time/fg_time.h \
+ ../Time/../Include/types.h ../Time/../Flight/flight.h \
+ ../Time/../Flight/Slew/slew.h \
  ../Time/../Flight/LaRCsim/ls_interface.h \
- ../Time/../Flight/LaRCsim/../flight.h ../general.h
-planets.o: planets.c ../Time/fg_time.h ../Time/../types.h \
+ ../Time/../Flight/LaRCsim/../flight.h ../Include/general.h
+planets.o: planets.c ../Time/fg_time.h ../Time/../Include/types.h \
  ../Time/../Flight/flight.h ../Time/../Flight/Slew/slew.h \
  ../Time/../Flight/LaRCsim/ls_interface.h \
  ../Time/../Flight/LaRCsim/../flight.h orbits.h planets.h sun.h
-scenery.o: scenery.c ../general.h astro.h stars.h obj.h scenery.h \
../types.h
-stars.o: stars.c orbits.h ../Time/fg_time.h ../Time/../types.h \
+scenery.o: scenery.c ../Include/general.h astro.h stars.h obj.h \
scenery.h ../Include/types.h
+stars.o: stars.c orbits.h ../Time/fg_time.h ../Time/../Include/types.h \
  ../Time/../Flight/flight.h ../Time/../Flight/Slew/slew.h \
  ../Time/../Flight/LaRCsim/ls_interface.h \
  ../Time/../Flight/LaRCsim/../flight.h planets.h stars.h \
- ../constants.h ../general.h ../Aircraft/aircraft.h \
+ ../Include/constants.h ../Include/general.h ../Aircraft/aircraft.h \
  ../Aircraft/../Flight/flight.h ../Aircraft/../Controls/controls.h \
- ../Aircraft/../Controls/../limits.h ../Main/views.h \
- ../Main/../types.h ../Main/../Flight/flight.h ../Main/../Math/mat3.h
-sun.o: sun.c ../Time/fg_time.h ../Time/../types.h \
+ ../Aircraft/../Controls/../Include/limits.h ../Main/views.h \
+ ../Main/../Include/types.h ../Main/../Flight/flight.h \
+ ../Main/../Math/mat3.h
+sun.o: sun.c ../Time/fg_time.h ../Time/../Include/types.h \
  ../Time/../Flight/flight.h ../Time/../Flight/Slew/slew.h \
  ../Time/../Flight/LaRCsim/ls_interface.h \
  ../Time/../Flight/LaRCsim/../flight.h ../Main/views.h \
- ../Main/../types.h ../Main/../Flight/flight.h ../Main/../Math/mat3.h \
- orbits.h sun.h
+ ../Main/../Include/types.h ../Main/../Flight/flight.h \
../Main/../Math/mat3.h orbits.h sun.h
index 595c23287a7d2356b894a9dc8257ebfb1ed5d9fc..c2535a32e9fca85f789fff90dacd296b9e3250ee 100644 (file)
@@ -38,8 +38,8 @@
 
 #include <GL/glut.h>
 
-#include "../constants.h"
-#include "../types.h"
+#include "../Include/constants.h"
+#include "../Include/types.h"
 #include "../Math/fg_geodesy.h"
 #include "../Math/fg_random.h"
 #include "../Math/mat3.h"
@@ -396,9 +396,13 @@ GLint mesh_to_OpenGL(struct MESH *m) {
 
 
 /* $Log$
-/* Revision 1.23  1997/10/30 12:38:44  curt
-/* Working on new scenery subsystem.
+/* Revision 1.24  1997/12/15 23:54:59  curt
+/* Add xgl wrappers for debugging.
+/* Generate terrain normals on the fly.
 /*
+ * Revision 1.23  1997/10/30 12:38:44  curt
+ * Working on new scenery subsystem.
+ *
  * Revision 1.22  1997/10/28 21:00:21  curt
  * Changing to new terrain format.
  *
index e72404f9ec7d69b59a23f36791cfeb96418d7cf2..ac97aa94e555fcd32c99055236efd395100a682e 100644 (file)
 
 #include <math.h>
 #include <GL/glut.h>
+#include "../XGL/xgl.h"
 
 #include "orbits.h"
 #include "moon.h"
 
-#include "../general.h"
+#include "../Include/general.h"
 #include "../Main/views.h"
 #include "../Time/fg_time.h"
 
@@ -72,15 +73,15 @@ void NormalizeVector(float v[3])
 
 void drawTriangle(float *v1, float *v2, float *v3)
 {
-   glBegin(GL_POLYGON);
-   //glBegin(GL_POINTS);
-      glNormal3fv(v1);
-      glVertex3fv(v1);
-      glNormal3fv(v2);
-      glVertex3fv(v2);
-      glNormal3fv(v3);
-      glVertex3fv(v3);
-   glEnd();
+   xglBegin(GL_POLYGON);
+   //xglBegin(GL_POINTS);
+      xglNormal3fv(v1);
+      xglVertex3fv(v1);
+      xglNormal3fv(v2);
+      xglVertex3fv(v2);
+      xglNormal3fv(v3);
+      xglVertex3fv(v3);
+   xglEnd();
 }
 
 void subdivide(float *v1, float *v2, float *v3, long depth)
@@ -112,17 +113,17 @@ void subdivide(float *v1, float *v2, float *v3, long depth)
 void display(void)
 {
    int i;
-   glClear(GL_COLOR_BUFFER_BIT);
-   glPushMatrix();
-   glRotatef(spin, 0.0, 0.0, 0.0);
-   glColor3f(1.0, 1.0, 0.0);
-//   glBegin(GL_LINE_LOOP);
+   xglClear(GL_COLOR_BUFFER_BIT);
+   xglPushMatrix();
+   xglRotatef(spin, 0.0, 0.0, 0.0);
+   xglColor3f(1.0, 1.0, 0.0);
+//   xglBegin(GL_LINE_LOOP);
    for (i = 0; i < 20; i++)
    {
 
-       //glVertex3fv(&vdata[tindices[i][0]][0]);
-       //glVertex3fv(&vdata[tindices[i][1]][0]);
-       //glVertex3fv(&vdata[tindices[i][2]][0]);
+       //xglVertex3fv(&vdata[tindices[i][0]][0]);
+       //xglVertex3fv(&vdata[tindices[i][1]][0]);
+       //xglVertex3fv(&vdata[tindices[i][2]][0]);
 
        subdivide(&vdata[tindices[i][0]][0],
                  &vdata[tindices[i][1]][0],
@@ -130,9 +131,9 @@ void display(void)
 
 
    }
-//   glEnd();
-  // glFlush();
-  glPopMatrix();
+//   xglEnd();
+  // xglFlush();
+  xglPopMatrix();
   glutSwapBuffers();
 } */
 
@@ -230,11 +231,11 @@ void fgMoonInit() {
 
     l = &cur_light_params;
 
-    moon = glGenLists(1);
-    glNewList(moon, GL_COMPILE );
+    moon = xglGenLists(1);
+    xglNewList(moon, GL_COMPILE );
 
-    /* glMaterialfv(GL_FRONT, GL_AMBIENT, l->scene_clear);
-    glMaterialfv(GL_FRONT, GL_DIFFUSE, moon_color); */
+    /* xglMaterialfv(GL_FRONT, GL_AMBIENT, l->scene_clear);
+    xglMaterialfv(GL_FRONT, GL_DIFFUSE, moon_color); */
 
     fgSolarSystemUpdate(&(pltOrbElements[1]), cur_time_params);
     moonPos = fgCalculateMoon(pltOrbElements[1], pltOrbElements[0], 
@@ -254,7 +255,7 @@ void fgMoonInit() {
 
     glutSolidSphere(1.0, 15, 15);
 
-    glEndList();
+    xglEndList();
 }
 
 
@@ -267,21 +268,21 @@ void fgMoonRender() {
     l = &cur_light_params;
 
     /* set lighting parameters */
-    glLightfv(GL_LIGHT0, GL_AMBIENT, l->scene_clear );
-    glLightfv(GL_LIGHT0, GL_DIFFUSE, moon_color );
+    xglLightfv(GL_LIGHT0, GL_AMBIENT, l->scene_clear );
+    xglLightfv(GL_LIGHT0, GL_DIFFUSE, moon_color );
 
-    glMaterialfv(GL_FRONT, GL_AMBIENT, l->scene_clear );
-    glMaterialfv(GL_FRONT, GL_AMBIENT, moon_color );
-    glMaterialfv(GL_FRONT, GL_DIFFUSE, moon_color);
+    xglMaterialfv(GL_FRONT, GL_AMBIENT, l->scene_clear );
+    xglMaterialfv(GL_FRONT, GL_AMBIENT, moon_color );
+    xglMaterialfv(GL_FRONT, GL_DIFFUSE, moon_color);
 
-    glPushMatrix();
-    glTranslatef(xMoon, yMoon, zMoon);
-    glScalef(1400, 1400, 1400);
+    xglPushMatrix();
+    xglTranslatef(xMoon, yMoon, zMoon);
+    xglScalef(1400, 1400, 1400);
 
-    glColor3fv(moon_color);
+    xglColor3fv(moon_color);
     /* glutSolidSphere(1.0, 25, 25); */
-    glCallList(moon);
+    xglCallList(moon);
 
-    glPopMatrix();
+    xglPopMatrix();
 }
 
index 11b12155ee887733e9d839c2626f741441cced31..0a3e53ec0149fd823c5014b10b3d38e0e78d5f51 100644 (file)
@@ -31,6 +31,7 @@
 #include <stdio.h>
 #include <string.h>
 #include <GL/glut.h>
+#include "../XGL/xgl.h"
 
 #include "obj.h"
 #include "scenery.h"
@@ -45,23 +46,40 @@ float nodes[MAXNODES][3];
 float normals[MAXNODES][3];
 
 
+/* given three points defining a triangle, calculate the normal */
+void calc_normal(float p1[3], float p2[3], float p3[3], double normal[3])
+{
+    double v1[3], v2[3];
+    float temp;
+
+    v1[0] = p2[0] - p1[0]; v1[1] = p2[1] - p1[1]; v1[2] = p2[2] - p1[2];
+    v2[0] = p3[0] - p1[0]; v2[1] = p3[1] - p1[1]; v2[2] = p3[2] - p1[2];
+
+    MAT3cross_product(normal, v1, v2);
+    MAT3_NORMALIZE_VEC(normal,temp);
+
+    printf("  Normal = %.2f %.2f %.2f\n", normal[0], normal[1], normal[2]);
+}
+
+
 /* Load a .obj file and generate the GL call list */
 GLint fgObjLoad(char *path) {
-    char line[256], winding[256];
+    char line[256], winding_str[256];
     double v1[3], v2[3], approx_normal[3], dot_prod, temp;
     struct fgCartesianPoint ref;
     GLint area;
     FILE *f;
     int first, ncount, vncount, n1, n2, n3, n4;
-    int i;
+    int i, winding;
+    int last1, last2, odd;
 
     if ( (f = fopen(path, "r")) == NULL ) {
        printf("Cannot open file: %s\n", path);
        exit(-1);
     }
 
-    area = glGenLists(1);
-    glNewList(area, GL_COMPILE);
+    area = xglGenLists(1);
+    xglNewList(area, GL_COMPILE);
 
     first = 1;
     ncount = 1;
@@ -101,17 +119,19 @@ GLint fgObjLoad(char *path) {
                exit(-1);
            }
        } else if ( strncmp(line, "winding ", 8) == 0 ) {
-           sscanf(line+8, "%s", winding);
-           printf("WINDING = %s\n", winding);
+           sscanf(line+8, "%s", winding_str);
+           printf("WINDING = %s\n", winding_str);
 
-           /* can't call glFrontFace() between glBegin() & glEnd() */
-           glEnd();
+           /* can't call xglFrontFace() between xglBegin() & xglEnd() */
+           xglEnd();
            first = 1;
 
-           if ( strcmp(winding, "cw") == 0 ) {
-               glFrontFace( GL_CW );
+           if ( strcmp(winding_str, "cw") == 0 ) {
+               xglFrontFace( GL_CW );
+               winding = 0;
            } else {
-               glFrontFace ( GL_CCW );
+               xglFrontFace ( GL_CCW );
+               winding = 1;
            }
        } else if ( line[0] == 't' ) {
            /* start a new triangle strip */
@@ -120,12 +140,12 @@ GLint fgObjLoad(char *path) {
 
            if ( !first ) {
                /* close out the previous structure and start the next */
-               glEnd();
+               xglEnd();
            } else {
                first = 0;
            }
 
-           /* printf("new tri strip = %s", line); */
+           printf("new tri strip = %s", line);
            sscanf(line, "t %d %d %d %d\n", &n1, &n2, &n3, &n4);
 
            /* printf("(t) = "); */
@@ -133,7 +153,7 @@ GLint fgObjLoad(char *path) {
            /* try to get the proper rotation by calculating an
              * approximate normal and seeing if it is close to the
             * precalculated normal */
-           /*v1[0] = nodes[n2][0] - nodes[n1][0];
+           /* v1[0] = nodes[n2][0] - nodes[n1][0];
            v1[1] = nodes[n2][1] - nodes[n1][1];
            v1[2] = nodes[n2][2] - nodes[n1][2];
            v2[0] = nodes[n3][0] - nodes[n1][0];
@@ -149,56 +169,87 @@ GLint fgObjLoad(char *path) {
            /* printf("Normal ANGLE = %.3f rads.\n", angle); */
 
            /* if ( dot_prod < -0.5 ) {
-               glFrontFace( GL_CW );
+               xglFrontFace( GL_CW );
            } else {
-               glFrontFace( GL_CCW );
+               xglFrontFace( GL_CCW );
            } */
 
-           glBegin(GL_TRIANGLE_STRIP);
+           xglBegin(GL_TRIANGLE_STRIP);
+
+           if ( winding ) {
+               odd = 1; 
+           } else {
+               odd = 0;
+           }
+
+           if ( odd ) {
+               calc_normal(nodes[n1], nodes[n2], nodes[n3], approx_normal);
+           } else {
+               calc_normal(nodes[n2], nodes[n1], nodes[n3], approx_normal);
+           }
+           xglNormal3dv(approx_normal);
 
-            glNormal3d(normals[n1][0], normals[n1][1], normals[n1][2]);
-           glVertex3d(nodes[n1][0] - ref.x, nodes[n1][1] - ref.y, 
-                      nodes[n1][2] - ref.z);
+            /* xglNormal3d(normals[n1][0], normals[n1][1], normals[n1][2]); */
+           xglVertex3d(nodes[n1][0] - ref.x, nodes[n1][1] - ref.y, 
+                       nodes[n1][2] - ref.z);
 
-           glNormal3d(normals[n2][0], normals[n2][1], normals[n2][2]);
-           glVertex3d(nodes[n2][0] - ref.x, nodes[n2][1] - ref.y, 
-                      nodes[n2][2] - ref.z);
+           /* xglNormal3d(normals[n2][0], normals[n2][1], normals[n2][2]); */
+           xglVertex3d(nodes[n2][0] - ref.x, nodes[n2][1] - ref.y, 
+                       nodes[n2][2] - ref.z);
 
-           glNormal3d(normals[n3][0], normals[n3][1], normals[n3][2]);
-           glVertex3d(nodes[n3][0] - ref.x, nodes[n3][1] - ref.y, 
-                      nodes[n3][2] - ref.z);
+           /* xglNormal3d(normals[n3][0], normals[n3][1], normals[n3][2]); */
+           xglVertex3d(nodes[n3][0] - ref.x, nodes[n3][1] - ref.y, 
+                       nodes[n3][2] - ref.z);
+
+           odd = 1 - odd;
+           last1 = n2;
+           last2 = n3;
 
            if ( n4 > 0 ) {
-               glNormal3d(normals[n4][0], normals[n4][1], normals[n4][2]);
-               glVertex3d(nodes[n4][0] - ref.x, nodes[n4][1] - ref.y, 
-                          nodes[n4][2] - ref.z);
+               if ( odd ) {
+                   calc_normal(nodes[last1], nodes[last2], nodes[n4], 
+                               approx_normal);
+               } else {
+                   calc_normal(nodes[last2], nodes[last1], nodes[n4], 
+                               approx_normal);
+               }
+               calc_normal(nodes[n3], nodes[n2], nodes[n4], approx_normal);
+               xglNormal3dv(approx_normal);
+
+               /*xglNormal3d(normals[n4][0], normals[n4][1], normals[n4][2]);*/
+               xglVertex3d(nodes[n4][0] - ref.x, nodes[n4][1] - ref.y, 
+                           nodes[n4][2] - ref.z);
+
+               odd = 1 - odd;
+               last1 = n3;
+               last2 = n4;
            }
        } else if ( line[0] == 'f' ) {
            /* unoptimized face */
 
            if ( !first ) {
                /* close out the previous structure and start the next */
-               glEnd();
+               xglEnd();
            } else {
                first = 0;
            }
 
-           glBegin(GL_TRIANGLES);
+           xglBegin(GL_TRIANGLES);
 
            /* printf("new triangle = %s", line);*/
            sscanf(line, "f %d %d %d\n", &n1, &n2, &n3);
 
-            glNormal3d(normals[n1][0], normals[n1][1], normals[n1][2]);
-           glVertex3d(nodes[n1][0] - ref.x, nodes[n1][1] - ref.y, 
-                      nodes[n1][2] - ref.z);
+            xglNormal3d(normals[n1][0], normals[n1][1], normals[n1][2]);
+           xglVertex3d(nodes[n1][0] - ref.x, nodes[n1][1] - ref.y, 
+                       nodes[n1][2] - ref.z);
 
-            glNormal3d(normals[n2][0], normals[n2][1], normals[n2][2]);
-           glVertex3d(nodes[n2][0] - ref.x, nodes[n2][1] - ref.y, 
-                      nodes[n2][2] - ref.z);
+            xglNormal3d(normals[n2][0], normals[n2][1], normals[n2][2]);
+           xglVertex3d(nodes[n2][0] - ref.x, nodes[n2][1] - ref.y, 
+                       nodes[n2][2] - ref.z);
 
-            glNormal3d(normals[n3][0], normals[n3][1], normals[n3][2]);
-           glVertex3d(nodes[n3][0] - ref.x, nodes[n3][1] - ref.y, 
-                      nodes[n3][2] - ref.z);
+            xglNormal3d(normals[n3][0], normals[n3][1], normals[n3][2]);
+           xglVertex3d(nodes[n3][0] - ref.x, nodes[n3][1] - ref.y, 
+                       nodes[n3][2] - ref.z);
        } else if ( line[0] == 'q' ) {
            /* continue a triangle strip */
            n1 = n2 = 0;
@@ -207,39 +258,65 @@ GLint fgObjLoad(char *path) {
            sscanf(line, "q %d %d\n", &n1, &n2);
            /* printf("read %d %d\n", n1, n2); */
 
-            glNormal3d(normals[n1][0], normals[n1][1], normals[n1][2]);
-           glVertex3d(nodes[n1][0] - ref.x, nodes[n1][1] - ref.y, 
-                      nodes[n1][2] - ref.z);
+           if ( odd ) {
+               calc_normal(nodes[last1], nodes[last2], nodes[n1], 
+                           approx_normal);
+           } else {
+               calc_normal(nodes[last2], nodes[last1], nodes[n1], 
+                           approx_normal);
+           }
+           xglNormal3dv(approx_normal);
+
+            /* xglNormal3d(normals[n1][0], normals[n1][1], normals[n1][2]); */
+           xglVertex3d(nodes[n1][0] - ref.x, nodes[n1][1] - ref.y, 
+                       nodes[n1][2] - ref.z);
+           
+           odd = 1 - odd;
+           last1 = last2;
+           last2 = n1;
 
            if ( n2 > 0 ) {
                /* printf(" (cont)\n"); */
-               glNormal3d(normals[n2][0], normals[n2][1], normals[n2][2]);
-               glVertex3d(nodes[n2][0] - ref.x, nodes[n2][1] - ref.y, 
-                          nodes[n2][2] - ref.z);
+               if ( odd ) {
+                   calc_normal(nodes[last1], nodes[last2], nodes[n2], 
+                               approx_normal);
+               } else {
+                   calc_normal(nodes[last2], nodes[last1], nodes[n2], 
+                               approx_normal);
+               }
+               xglNormal3dv(approx_normal);
+
+               /*xglNormal3d(normals[n2][0], normals[n2][1], normals[n2][2]);*/
+               xglVertex3d(nodes[n2][0] - ref.x, nodes[n2][1] - ref.y, 
+                           nodes[n2][2] - ref.z);
+
+               odd = 1 -odd;
+               last1 = last2;
+               last2 = n2;
            }
        } else {
            printf("Unknown line in %s = %s\n", path, line);
        }
     }
 
-    glEnd();
+    xglEnd();
 
     /* Draw normal vectors (for visually verifying normals)*/
     /*
-    glBegin(GL_LINES);
-    glColor3f(0.0, 0.0, 0.0);
+    xglBegin(GL_LINES);
+    xglColor3f(0.0, 0.0, 0.0);
     for ( i = 0; i < ncount; i++ ) {
-       glVertex3d(nodes[i][0] - ref.x,
-                  nodes[i][1] - ref.y,
-                  nodes[i][2] - ref.z);
-       glVertex3d(nodes[i][0] - ref.x + 500*normals[i][0],
-                  nodes[i][1] - ref.y + 500*normals[i][1],
-                  nodes[i][2] - ref.z + 500*normals[i][2]);
+        xglVertex3d(nodes[i][0] - ref.x,
+                   nodes[i][1] - ref.y,
+                   nodes[i][2] - ref.z);
+       xglVertex3d(nodes[i][0] - ref.x + 500*normals[i][0],
+                   nodes[i][1] - ref.y + 500*normals[i][1],
+                   nodes[i][2] - ref.z + 500*normals[i][2]);
     } 
-    glEnd();
+    xglEnd();
     */
 
-    glEndList();
+    xglEndList();
 
     fclose(f);
 
@@ -248,9 +325,13 @@ GLint fgObjLoad(char *path) {
 
 
 /* $Log$
-/* Revision 1.10  1997/12/12 21:41:28  curt
-/* More light/material property tweaking ... still a ways off.
+/* Revision 1.11  1997/12/15 23:55:01  curt
+/* Add xgl wrappers for debugging.
+/* Generate terrain normals on the fly.
 /*
+ * Revision 1.10  1997/12/12 21:41:28  curt
+ * More light/material property tweaking ... still a ways off.
+ *
  * Revision 1.9  1997/12/12 19:52:57  curt
  * Working on lightling and material properties.
  *
index 4e10843aba002d2a79b30ccac19539064e13e69a..8ff0f182cf8c1ad1ee3525f3a1bbd8327666c446 100644 (file)
@@ -27,7 +27,7 @@
 
 #include "orbits.h"
 
-#include "../general.h"
+#include "../Include/general.h"
 #include "../Time/fg_time.h"
 
 
@@ -170,10 +170,14 @@ void fgSolarSystemUpdate(struct OrbElements *planet, struct fgTIME t)
 
 
 /* $Log$
-/* Revision 1.4  1997/12/10 22:37:51  curt
-/* Prepended "fg" on the name of all global structures that didn't have it yet.
-/* i.e. "struct WEATHER {}" became "struct fgWEATHER {}"
+/* Revision 1.5  1997/12/15 23:55:02  curt
+/* Add xgl wrappers for debugging.
+/* Generate terrain normals on the fly.
 /*
+ * Revision 1.4  1997/12/10 22:37:51  curt
+ * Prepended "fg" on the name of all global structures that didn't have it yet.
+ * i.e. "struct WEATHER {}" became "struct fgWEATHER {}"
+ *
  * Revision 1.3  1997/11/25 23:20:44  curt
  * Changed planets.dat Planets.dat
  *
index 003920123091a3cf87350352c693f6044c17c758..43913ba26ab57d2bf010b85228c975325ee07458 100644 (file)
 #endif
 
 #include <GL/glut.h>
+#include "../XGL/xgl.h"
+
 #include <stdio.h>
 #include <string.h>
 
-#include "../general.h"
+#include "../Include/general.h"
 
 #include "astro.h"
 #include "obj.h"
@@ -80,27 +82,31 @@ void fgSceneryUpdate(double lon, double lat, double elev) {
 
 /* Render out the current scene */
 void fgSceneryRender() {
-    static GLfloat terrain_color[4] = { 0.4, 0.8, 0.3, 1.0 };
+    static GLfloat terrain_color[4] = { 0.6, 0.8, 0.4, 1.0 };
     static GLfloat terrain_ambient[4];
     static GLfloat terrain_diffuse[4];
     int i;
 
     for ( i = 0; i < 4; i++ ) {
-       terrain_ambient[i] = terrain_color[i];
+       terrain_ambient[i] = terrain_color[i] * 0.5;
        terrain_diffuse[i] = terrain_color[i];
     }
 
-    glMaterialfv(GL_FRONT, GL_AMBIENT, terrain_ambient);
-    glMaterialfv(GL_FRONT, GL_DIFFUSE, terrain_diffuse);
+    xglMaterialfv(GL_FRONT, GL_AMBIENT, terrain_ambient);
+    xglMaterialfv(GL_FRONT, GL_DIFFUSE, terrain_diffuse);
 
-    glCallList(area_terrain);
+    xglCallList(area_terrain);
 }
 
 
 /* $Log$
-/* Revision 1.27  1997/12/12 21:41:30  curt
-/* More light/material property tweaking ... still a ways off.
+/* Revision 1.28  1997/12/15 23:55:02  curt
+/* Add xgl wrappers for debugging.
+/* Generate terrain normals on the fly.
 /*
+ * Revision 1.27  1997/12/12 21:41:30  curt
+ * More light/material property tweaking ... still a ways off.
+ *
  * Revision 1.26  1997/12/12 19:52:58  curt
  * Working on lightling and material properties.
  *
index f9f619c34ae042c372458e90fc5ee27e82d7760f..869d893e80c366a790bb4ec53049516ea405a8d0 100644 (file)
@@ -28,7 +28,7 @@
 #define SCENERY_H
 
 
-#include "../types.h"
+#include "../Include/types.h"
 
 
 /* Define a structure containing global scenery parameters */
@@ -63,10 +63,14 @@ void fgSceneryRender();
 
 
 /* $Log$
-/* Revision 1.11  1997/12/10 22:37:52  curt
-/* Prepended "fg" on the name of all global structures that didn't have it yet.
-/* i.e. "struct WEATHER {}" became "struct fgWEATHER {}"
+/* Revision 1.12  1997/12/15 23:55:03  curt
+/* Add xgl wrappers for debugging.
+/* Generate terrain normals on the fly.
 /*
+ * Revision 1.11  1997/12/10 22:37:52  curt
+ * Prepended "fg" on the name of all global structures that didn't have it yet.
+ * i.e. "struct WEATHER {}" became "struct fgWEATHER {}"
+ *
  * Revision 1.10  1997/09/04 02:17:37  curt
  * Shufflin' stuff.
  *
index 692ceaba10827b29c90e6439ed2f9e122fce251b..d3c671055cf18d6b0d8ec0378b5a68aa3bc73882 100644 (file)
 #include <time.h>
 
 #include <GL/glut.h>
+#include "../XGL/xgl.h"
 
 #include "orbits.h"
 #include "planets.h"
 #include "stars.h"
 
-#include "../constants.h"
-#include "../general.h"
+#include "../Include/constants.h"
+#include "../Include/general.h"
 #include "../Aircraft/aircraft.h"
 #include "../Main/views.h"
 #include "../Time/fg_time.h"
@@ -85,9 +86,9 @@ void fgStarsInit() {
            return;
        }
        
-       stars[i] = glGenLists(1);
-       glNewList( stars[i], GL_COMPILE );
-       glBegin( GL_POINTS );
+       stars[i] = xglGenLists(1);
+       xglNewList( stars[i], GL_COMPILE );
+       xglBegin( GL_POINTS );
 
        /* read in each line of the file */
        count = 0;
@@ -150,11 +151,11 @@ void fgStarsInit() {
                /* printf("Found star: %d %s, %.3f %.3f %.3f\n", count,
                       name, right_ascension, declination, magnitude); */
 
-               glColor3f( magnitude, magnitude, magnitude );
-               /*glColor3f(0,0,0);*/
-               glVertex3f( 190000.0 * cos(right_ascension) * cos(declination),
-                           190000.0 * sin(right_ascension) * cos(declination),
-                           190000.0 * sin(declination) );
+               xglColor3f( magnitude, magnitude, magnitude );
+               /*xglColor3f(0,0,0);*/
+               xglVertex3f( 190000.0 * cos(right_ascension) * cos(declination),
+                            190000.0 * sin(right_ascension) * cos(declination),
+                            190000.0 * sin(declination) );
                
                count++;
            } /* if valid line */
@@ -170,52 +171,52 @@ void fgStarsInit() {
            printf("Planet found at %f (ra), %f (dec)\n", 
                   pltPos.RightAscension, pltPos.Declination);
            /* give the planets a temporary color, for testing purposes */
-           glColor3f( 1.0, 0.0, 0.0);
-           glVertex3f( 190000.0 * cos(pltPos.RightAscension) * 
-                       cos(pltPos.Declination),
-                       190000.0 * sin(pltPos.RightAscension) * 
-                       cos(pltPos.Declination),
-                       190000.0 * sin(pltPos.Declination) );
+           xglColor3f( 1.0, 0.0, 0.0);
+           xglVertex3f( 190000.0 * cos(pltPos.RightAscension) * 
+                        cos(pltPos.Declination),
+                        190000.0 * sin(pltPos.RightAscension) * 
+                        cos(pltPos.Declination),
+                        190000.0 * sin(pltPos.Declination) );
        }
-       glEnd();
+       xglEnd();
 
        /*
-       glBegin(GL_LINE_LOOP);
-        glColor3f(1.0, 0.0, 0.0);
-       glVertex3f( 190000.0 * cos(ra_save-0.2) * cos(decl_save-0.2),
+       xglBegin(GL_LINE_LOOP);
+        xglColor3f(1.0, 0.0, 0.0);
+       xglVertex3f( 190000.0 * cos(ra_save-0.2) * cos(decl_save-0.2),
                    190000.0 * sin(ra_save-0.2) * cos(decl_save-0.2),
                    190000.0 * sin(decl_save-0.2) );
-       glVertex3f( 190000.0 * cos(ra_save+0.2) * cos(decl_save-0.2),
+       xglVertex3f( 190000.0 * cos(ra_save+0.2) * cos(decl_save-0.2),
                    190000.0 * sin(ra_save+0.2) * cos(decl_save-0.2),
                    190000.0 * sin(decl_save-0.2) );
-       glVertex3f( 190000.0 * cos(ra_save+0.2) * cos(decl_save+0.2),
+       xglVertex3f( 190000.0 * cos(ra_save+0.2) * cos(decl_save+0.2),
                    190000.0 * sin(ra_save+0.2) * cos(decl_save+0.2),
                    190000.0 * sin(decl_save+0.2) );
-       glVertex3f( 190000.0 * cos(ra_save-0.2) * cos(decl_save+0.2),
+       xglVertex3f( 190000.0 * cos(ra_save-0.2) * cos(decl_save+0.2),
                    190000.0 * sin(ra_save-0.2) * cos(decl_save+0.2),
                    190000.0 * sin(decl_save+0.2) );
-       glEnd();
+       xglEnd();
        */
 
        /*
-       glBegin(GL_LINE_LOOP);
-        glColor3f(0.0, 1.0, 0.0);
-       glVertex3f( 190000.0 * cos(ra_save1-0.2) * cos(decl_save1-0.2),
+       xglBegin(GL_LINE_LOOP);
+        xglColor3f(0.0, 1.0, 0.0);
+       xglVertex3f( 190000.0 * cos(ra_save1-0.2) * cos(decl_save1-0.2),
                    190000.0 * sin(ra_save1-0.2) * cos(decl_save1-0.2),
                    190000.0 * sin(decl_save1-0.2) );
-       glVertex3f( 190000.0 * cos(ra_save1+0.2) * cos(decl_save1-0.2),
+       xglVertex3f( 190000.0 * cos(ra_save1+0.2) * cos(decl_save1-0.2),
                    190000.0 * sin(ra_save1+0.2) * cos(decl_save1-0.2),
                    190000.0 * sin(decl_save1-0.2) );
-       glVertex3f( 190000.0 * cos(ra_save1+0.2) * cos(decl_save1+0.2),
+       xglVertex3f( 190000.0 * cos(ra_save1+0.2) * cos(decl_save1+0.2),
                    190000.0 * sin(ra_save1+0.2) * cos(decl_save1+0.2),
                    190000.0 * sin(decl_save1+0.2) );
-       glVertex3f( 190000.0 * cos(ra_save1-0.2) * cos(decl_save1+0.2),
+       xglVertex3f( 190000.0 * cos(ra_save1-0.2) * cos(decl_save1+0.2),
                    190000.0 * sin(ra_save1-0.2) * cos(decl_save1+0.2),
                    190000.0 * sin(decl_save1+0.2) );
-       glEnd();
+       xglEnd();
        */
        
-       glEndList();
+       xglEndList();
 
        max_stars /= 2;
     }
@@ -254,9 +255,9 @@ void fgStarsRender() {
 
        printf("RENDERING STARS = %d (night)\n", i);
 
-       glDisable( GL_LIGHTING );
-       glCallList(stars[i]);
-       glEnable( GL_LIGHTING );
+       xglDisable( GL_LIGHTING );
+       xglCallList(stars[i]);
+       xglEnable( GL_LIGHTING );
     } else {
        printf("not RENDERING STARS (day)\n");
     }
@@ -264,9 +265,13 @@ void fgStarsRender() {
 
 
 /* $Log$
-/* Revision 1.19  1997/12/12 19:53:00  curt
-/* Working on lightling and material properties.
+/* Revision 1.20  1997/12/15 23:55:03  curt
+/* Add xgl wrappers for debugging.
+/* Generate terrain normals on the fly.
 /*
+ * Revision 1.19  1997/12/12  19:53:00  curt
+ * Working on lightling and material properties.
+ *
  * Revision 1.18  1997/12/10 22:37:52  curt
  * Prepended "fg" on the name of all global structures that didn't have it yet.
  * i.e. "struct WEATHER {}" became "struct fgWEATHER {}"
index 2b97740cf3ecb10588cd59bc4b778677591cf2ac..e53dfbb53f99eb6df8890808a177fe042274a2a2 100644 (file)
@@ -23,6 +23,8 @@
  **************************************************************************/
 
 #include <GL/glut.h>
+#include "../XGL/xgl.h"
+
 #include "../Time/fg_time.h"
 #include "../Main/views.h"
 #include "orbits.h"
@@ -95,10 +97,10 @@ void fgSunInit()
 {
 //   int i;
 
-    sun_obj = glGenLists(1);
-    glNewList(sun_obj, GL_COMPILE );
+    sun_obj = xglGenLists(1);
+    xglNewList(sun_obj, GL_COMPILE );
 
-//     glBegin( GL_POINTS );
+//     xglBegin( GL_POINTS );
 
     fgSolarSystemUpdate(&(pltOrbElements[0]), cur_time_params);
     sunPos = fgCalculateSun(pltOrbElements[0], cur_time_params);
@@ -108,13 +110,13 @@ void fgSunInit()
 #endif
 
     /* give the moon a temporary color, for testing purposes */
-//   glColor3f( 0.0, 1.0, 0.0);
-//   glVertex3f( 190000.0 * cos(moonPos.RightAscension) * cos(moonPos.Declination),
+//   xglColor3f( 0.0, 1.0, 0.0);
+//   xglVertex3f( 190000.0 * cos(moonPos.RightAscension) * cos(moonPos.Declination),
  //              190000.0 * sin(moonPos.RightAscension) * cos(moonPos.Declination),
 //                190000.0 * sin(moonPos.Declination) );
-   //glVertex3f(0.0, 0.0, 0.0);
-//   glEnd();
-//   glColor3f(1.0, 1.0, 1.0);
+   //xglVertex3f(0.0, 0.0, 0.0);
+//   xglEnd();
+//   xglColor3f(1.0, 1.0, 1.0);
    //xMoon = 190000.0 * cos(moonPos.RightAscension) * cos(moonPos.Declination);
    //yMoon = 190000.0 * sin(moonPos.RightAscension) * cos(moonPos.Declination);
    //zMoon = 190000.0 * sin(moonPos.Declination);
@@ -123,22 +125,22 @@ void fgSunInit()
    ySun = 60000.0 * sin(sunPos.RightAscension) * cos(sunPos.Declination);
    zSun = 60000.0 * sin(sunPos.Declination);
 
-//   glPushMatrix();
-//   glTranslatef(x, y, z);
-//   glScalef(16622.8, 16622.8, 16622.8);
-//     glBegin(GL_TRIANGLES);
+//   xglPushMatrix();
+//   xglTranslatef(x, y, z);
+//   xglScalef(16622.8, 16622.8, 16622.8);
+//     xglBegin(GL_TRIANGLES);
 //   for (i = 0; i < 20; i++)
 //      subdivide(&vdata[tindices[i][0]][0],
 //                &vdata[tindices[i][1]][0],
 //                &vdata[tindices[i][2]][0], 3);
 //     glutSolidSphere(1.0, 25, 25);
 
-//     glEnd();
-    //glPopMatrix();
+//     xglEnd();
+    //xglPopMatrix();
 
     glutSolidSphere(1.0, 10, 10);
 
-    glEndList();
+    xglEndList();
 }
 
 
@@ -178,33 +180,37 @@ void fgSunRender() {
     diff[3] = 0.0; */
 
     /* set lighting parameters */
-    /* glLightfv(GL_LIGHT0, GL_AMBIENT, color );
-    glLightfv(GL_LIGHT0, GL_DIFFUSE, color );
-    glMaterialfv(GL_FRONT, GL_AMBIENT, amb);
-    glMaterialfv(GL_FRONT, GL_DIFFUSE, diff); */
+    /* xglLightfv(GL_LIGHT0, GL_AMBIENT, color );
+    xglLightfv(GL_LIGHT0, GL_DIFFUSE, color );
+    xglMaterialfv(GL_FRONT, GL_AMBIENT, amb);
+    xglMaterialfv(GL_FRONT, GL_DIFFUSE, diff); */
 
-    glDisable( GL_LIGHTING );
+    xglDisable( GL_LIGHTING );
 
-    glPushMatrix();
-    glTranslatef(xSun, ySun, zSun);
-    glScalef(1400, 1400, 1400);
+    xglPushMatrix();
+    xglTranslatef(xSun, ySun, zSun);
+    xglScalef(1400, 1400, 1400);
 
-    glColor3f(0.85, 0.65, 0.05);
+    xglColor3f(0.85, 0.65, 0.05);
 
-    /* glColor3fv( color ); */
-    /* glutSolidSphere(1.0, 25, 25); */
-    glCallList(sun_obj);
+    /* xglColor3fv( color ); */
+    /* xglutSolidSphere(1.0, 25, 25); */
+    xglCallList(sun_obj);
 
-    glPopMatrix();
+    xglPopMatrix();
 
-    glEnable( GL_LIGHTING );
+    xglEnable( GL_LIGHTING );
 }
 
 
 /* $Log$
-/* Revision 1.5  1997/12/12 21:41:31  curt
-/* More light/material property tweaking ... still a ways off.
+/* Revision 1.6  1997/12/15 23:55:04  curt
+/* Add xgl wrappers for debugging.
+/* Generate terrain normals on the fly.
 /*
+ * Revision 1.5  1997/12/12 21:41:31  curt
+ * More light/material property tweaking ... still a ways off.
+ *
  * Revision 1.4  1997/12/10 22:37:53  curt
  * Prepended "fg" on the name of all global structures that didn't have it yet.
  * i.e. "struct WEATHER {}" became "struct fgWEATHER {}"
index 412a54ba736ba4a4c6adc5336bfd39c24cd557b4..f07b102e323af35dfd8db28685c45c46ea478637 100644 (file)
@@ -28,7 +28,8 @@ include make.inc
 
 
 SUBSUBDIRS = Flight/LaRCsim Flight/Slew
-SUBDIRS = Aircraft Cockpit Controls Flight Joystick Math Scenery Time Weather
+SUBDIRS = Aircraft Cockpit Controls Flight Joystick Math Scenery Time Weather \
+         XGL
 MAIN = Main
 
 
@@ -95,6 +96,10 @@ bin-zip:
 
 #---------------------------------------------------------------------------
 # $Log$
+# Revision 1.32  1997/12/15 23:54:25  curt
+# Add xgl wrappers for debugging.
+# Generate terrain normals on the fly.
+#
 # Revision 1.31  1997/12/15 20:59:08  curt
 # Misc. tweaks.
 #
index 171e041293d01982b9b2cf8935590723fb132763..78c22c80b611d6f2ec2390574e0f0d5c94d152f1 100644 (file)
@@ -30,7 +30,7 @@
 #---------------------------------------------------------------------------
 
 FG_VERSION_MAJOR = 0
-FG_VERSION_MINOR = 17
+FG_VERSION_MINOR = 18
 FG_VERSION = $(FG_VERSION_MAJOR).$(FG_VERSION_MINOR)
 
 
@@ -60,6 +60,8 @@ LN = ln -sf
 #
 # -O3 -fomit-frame-pointer -funroll-all-loops -ffast-math
 #              - Other potential compiler optimization flags
+#
+# -
 #---------------------------------------------------------------------------
 
 GLOBAL_CFLAGS = -g -Wall -DVERSION=\"$(FG_VERSION)\"
@@ -86,6 +88,17 @@ GLOBAL_CFLAGS = -g -Wall -DVERSION=\"$(FG_VERSION)\"
 #---------------------------------------------------------------------------
 
 
+#---------------------------------------------------------------------------
+# Debugging options.
+#
+# Uncomment the following two lines to enable OpenGL function call tracing.
+# This mechanism is provided courtesy of Steve Baker <sbaker@link.com>
+#---------------------------------------------------------------------------
+
+# FG_DEBUG_FLAGS = -DXGL_TRACE
+# FG_DEBUG_LIBS = ../XGL/libXGL.a
+
+
 #---------------------------------------------------------------------------
 # Uncomment one of the following sections depending on your system
 #
@@ -102,7 +115,7 @@ INTERFACE_FILES = GLUTmain.c GLUTkey.c
 MESA_LIBS = -L/usr/lib/mesa -lMesatk -lMesaaux -lMesaGLU -lMesaGL
 X11_LIBS =  -L/usr/X11R6/lib -lXext -lXmu -lXi -lX11
 GRAPHICS_LIBS = $(MESA_LIBS) $(X11_LIBS)
-FG_CFLAGS = $(GLOBAL_CFLAGS)
+FG_CFLAGS = $(GLOBAL_CFLAGS) $(FG_DEBUG_FLAGS)
 #---------------------------------------------------------------------------
 
 #---------------------------------------------------------------------------
@@ -114,7 +127,7 @@ FG_CFLAGS = $(GLOBAL_CFLAGS)
 # INTERFACE_LIBS = -lglut
 # INTERFACE_FILES = GLUTmain.c GLUTkey.c
 # GRAPHICS_LIBS = -lGLU -lGL -lXmu -lX11
-# FG_CFLAGS = $(GLOBAL_CFLAGS)
+# FG_CFLAGS = $(GLOBAL_CFLAGS) $(FG_DEBUG_FLAGS)
 #---------------------------------------------------------------------------
 
 #---------------------------------------------------------------------------
@@ -125,7 +138,7 @@ FG_CFLAGS = $(GLOBAL_CFLAGS)
 # INTERFACE_LIBS = -lglut
 # INTERFACE_FILES = GLUTmain.c GLUTkey.c
 # GRAPHICS_LIBS =  -lGLU -lGL -lXext -lXmu -lXi -lX11
-# FG_CFLAGS = $(GLOBAL_CFLAGS)
+# FG_CFLAGS = $(GLOBAL_CFLAGS) $(FG_DEBUG_FLAGS)
 #---------------------------------------------------------------------------
 
 #---------------------------------------------------------------------------
@@ -135,13 +148,17 @@ FG_CFLAGS = $(GLOBAL_CFLAGS)
 # INTERFACE_LIBS = ../Win32/libglut.a
 # INTERFACE_FILES = GLUTmain.c GLUTkey.c
 # GRAPHICS_LIBS = -lglu32 -lopengl32 -luser32 -lgdi32
-# FG_CFLAGS = $(GLOBAL_CFLAGS) -DWIN32 -DUSE_RAND
+# FG_CFLAGS = $(GLOBAL_CFLAGS) $(FG_DEBUG_FLAGS) -DWIN32 -DUSE_RAND
 # LN = copy
 #---------------------------------------------------------------------------
 
 
 #---------------------------------------------------------------------------
 # $Log$
+# Revision 1.25  1997/12/15 23:54:26  curt
+# Add xgl wrappers for debugging.
+# Generate terrain normals on the fly.
+#
 # Revision 1.24  1997/12/12 21:41:24  curt
 # More light/material property tweaking ... still a ways off.
 #
index 77fd35e4ea939ef0ae27adeaa9e9a6d345093102..bec72d53ab9b94d5062ad9bfec15d440edcb5c4d 100644 (file)
@@ -2,5 +2,5 @@ slew.o: slew.c slew.h ../flight.h ../Slew/slew.h \
  ../LaRCsim/ls_interface.h ../LaRCsim/../flight.h \
  ../../Aircraft/aircraft.h ../../Aircraft/../Flight/flight.h \
  ../../Aircraft/../Controls/controls.h \
- ../../Aircraft/../Controls/../limits.h ../../Controls/controls.h \
- ../../constants.h
+ ../../Aircraft/../Controls/../Include/limits.h \
+ ../../Controls/controls.h ../../Include/constants.h
index 3f81dfb1748cf8fd4678f0def8a937fdbe415a86..12702e04dbcd4ccb58bd6185911aca4f9f7f682b 100644 (file)
@@ -30,7 +30,7 @@
 #include "../flight.h"
 #include "../../Aircraft/aircraft.h"
 #include "../../Controls/controls.h"
-#include "../../constants.h"
+#include "../../Include/constants.h"
 
 
 #ifndef M_PI                                    
@@ -91,9 +91,13 @@ void fgSlewUpdate() {
 
 
 /* $Log$
-/* Revision 1.6  1997/08/27 03:30:11  curt
-/* Changed naming scheme of basic shared structures.
+/* Revision 1.7  1997/12/15 23:54:42  curt
+/* Add xgl wrappers for debugging.
+/* Generate terrain normals on the fly.
 /*
+ * Revision 1.6  1997/08/27 03:30:11  curt
+ * Changed naming scheme of basic shared structures.
+ *
  * Revision 1.5  1997/07/19 22:35:06  curt
  * Moved fiddled with PI to avoid compiler warnings.
  *
index b6739f0e6882d30435edd650771b8422b33c11f2..8eb45bb2243fdc769e490a20a7f3ac5dfc36b452 100644 (file)
@@ -1,12 +1,14 @@
-fg_time.o: fg_time.c fg_time.h ../types.h ../Flight/flight.h \
+fg_time.o: fg_time.c fg_time.h ../Include/types.h ../Flight/flight.h \
  ../Flight/Slew/slew.h ../Flight/LaRCsim/ls_interface.h \
- ../Flight/LaRCsim/../flight.h ../constants.h ../Time/fg_time.h
+ ../Flight/LaRCsim/../flight.h ../Include/constants.h \
+ ../Time/fg_time.h
 fg_timer.o: fg_timer.c fg_timer.h
-sidereal.o: sidereal.c ../constants.h
-sunpos.o: sunpos.c sunpos.h ../types.h fg_time.h ../Flight/flight.h \
- ../Flight/Slew/slew.h ../Flight/LaRCsim/ls_interface.h \
- ../Flight/LaRCsim/../flight.h ../constants.h ../Main/views.h \
- ../Main/../types.h ../Main/../Flight/flight.h ../Main/../Math/mat3.h \
+sidereal.o: sidereal.c ../Include/constants.h
+sunpos.o: sunpos.c sunpos.h ../Include/types.h fg_time.h \
+ ../Flight/flight.h ../Flight/Slew/slew.h \
+ ../Flight/LaRCsim/ls_interface.h ../Flight/LaRCsim/../flight.h \
+ ../Include/constants.h ../Main/views.h ../Main/../Include/types.h \
+ ../Main/../Flight/flight.h ../Main/../Math/mat3.h \
  ../Math/fg_geodesy.h ../Math/mat3.h ../Math/polar.h \
- ../Math/../types.h
+ ../Math/../Include/types.h
 ttest.o: ttest.c
index 513b5c181ce7cf047da70559c17af01534f4e458..07acaa3d82ed7c4b4aa5ab4a02f8da0e3909f7cb 100644 (file)
@@ -35,7 +35,7 @@
 #endif
 
 #include "fg_time.h"
-#include "../constants.h"
+#include "../Include/constants.h"
 #include "../Flight/flight.h"
 #include "../Time/fg_time.h"
 
@@ -285,9 +285,13 @@ void fgTimeUpdate(struct fgFLIGHT *f, struct fgTIME *t) {
 
 
 /* $Log$
-/* Revision 1.19  1997/12/15 20:59:10  curt
-/* Misc. tweaks.
+/* Revision 1.20  1997/12/15 23:55:06  curt
+/* Add xgl wrappers for debugging.
+/* Generate terrain normals on the fly.
 /*
+ * Revision 1.19  1997/12/15 20:59:10  curt
+ * Misc. tweaks.
+ *
  * Revision 1.18  1997/12/12 21:41:31  curt
  * More light/material property tweaking ... still a ways off.
  *
index 30a9e2440bb5018ea3d8478bb95c5f179cc125b4..155335fe4301db42ebf103b07653129cefdcec60 100644 (file)
@@ -35,7 +35,7 @@
 #include <GL/glut.h>
 #include <time.h>
 
-#include "../types.h"
+#include "../Include/types.h"
 #include "../Flight/flight.h"
 
 
@@ -92,10 +92,14 @@ void fgTimeUpdate(struct fgFLIGHT *f, struct fgTIME *t);
 
 
 /* $Log$
-/* Revision 1.9  1997/12/10 22:37:55  curt
-/* Prepended "fg" on the name of all global structures that didn't have it yet.
-/* i.e. "struct WEATHER {}" became "struct fgWEATHER {}"
+/* Revision 1.10  1997/12/15 23:55:07  curt
+/* Add xgl wrappers for debugging.
+/* Generate terrain normals on the fly.
 /*
+ * Revision 1.9  1997/12/10 22:37:55  curt
+ * Prepended "fg" on the name of all global structures that didn't have it yet.
+ * i.e. "struct WEATHER {}" became "struct fgWEATHER {}"
+ *
  * Revision 1.8  1997/12/09 04:25:38  curt
  * Working on adding a global lighting params structure.
  *
index 5d4c31db2bfa72bc3311b7ed4f1576528b1831aa..e1b0e16a602a664c1f808c8f0c07d2202e95bb7a 100644 (file)
@@ -45,7 +45,7 @@
 
 #include "sunpos.h"
 #include "fg_time.h"
-#include "../constants.h"
+#include "../Include/constants.h"
 #include "../Main/views.h"
 #include "../Math/fg_geodesy.h"
 #include "../Math/mat3.h"
@@ -316,10 +316,14 @@ void fgUpdateSunPos(struct fgCartesianPoint scenery_center) {
 
 
 /* $Log$
-/* Revision 1.16  1997/12/11 04:43:57  curt
-/* Fixed sun vector and lighting problems.  I thing the moon is now lit
-/* correctly.
+/* Revision 1.17  1997/12/15 23:55:08  curt
+/* Add xgl wrappers for debugging.
+/* Generate terrain normals on the fly.
 /*
+ * Revision 1.16  1997/12/11 04:43:57  curt
+ * Fixed sun vector and lighting problems.  I thing the moon is now lit
+ * correctly.
+ *
  * Revision 1.15  1997/12/10 22:37:55  curt
  * Prepended "fg" on the name of all global structures that didn't have it yet.
  * i.e. "struct WEATHER {}" became "struct fgWEATHER {}"
index 96f582a33cbece68ace1da6b8ffa16c7e0030334..c4e754867e0f2f5606997b2e0db0d6cc37032e0b 100644 (file)
@@ -42,7 +42,7 @@
 
 #include <time.h>
 
-#include "../types.h"
+#include "../Include/types.h"
 
 /* update the cur_time_params structure with the current sun position */
 void fgUpdateSunPos(struct fgCartesianPoint scenery_center);
index d94f0760f3603a5be8713365bedc07f74cad79dc..1bfe93835854020ffe64adf9bf9c248c9c4592a9 100644 (file)
@@ -3,4 +3,4 @@ weather.o: weather.c weather.h ../Aircraft/aircraft.h \
  ../Aircraft/../Flight/LaRCsim/ls_interface.h \
  ../Aircraft/../Flight/LaRCsim/../flight.h \
  ../Aircraft/../Controls/controls.h \
- ../Aircraft/../Controls/../limits.h ../Math/fg_random.h
+ ../Aircraft/../Controls/../Include/limits.h ../Math/fg_random.h