]> git.mxchange.org Git - simgear.git/blobdiff - Scenery/sun.c
Add xgl wrappers for debugging.
[simgear.git] / Scenery / sun.c
index f4ae4e9b014df8a5bb6278a19bf81930f1972fef..e53dfbb53f99eb6df8890808a177fe042274a2a2 100644 (file)
  **************************************************************************/
 
 #include <GL/glut.h>
+#include "../XGL/xgl.h"
+
 #include "../Time/fg_time.h"
 #include "../Main/views.h"
 #include "orbits.h"
 #include "sun.h"
 
-GLint sun;
+GLint sun_obj;
 
 static struct CelestialCoord sunPos;
 
@@ -95,10 +97,10 @@ void fgSunInit()
 {
 //   int i;
 
-    sun = glGenLists(1);
-    glNewList(sun, 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,29 +125,28 @@ 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();
 
-    glColor3f(0.85, 0.65, 0.05);
     glutSolidSphere(1.0, 10, 10);
 
-    glEndList();
+    xglEndList();
 }
 
 
 /* Draw the Sun */
 void fgSunRender() {
-    struct VIEW *v;
+    struct fgVIEW *v;
     struct fgTIME *t;
     GLfloat color[4] = { 0.85, 0.65, 0.05, 1.0 };
     /* double x_2, x_4, x_8, x_10; */
@@ -179,31 +180,44 @@ 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); */
+
+    xglDisable( GL_LIGHTING );
 
-    glDisable( GL_LIGHTING );
+    xglPushMatrix();
+    xglTranslatef(xSun, ySun, zSun);
+    xglScalef(1400, 1400, 1400);
 
-    glPushMatrix();
-    glTranslatef(xSun, ySun, zSun);
-    glScalef(1400, 1400, 1400);
+    xglColor3f(0.85, 0.65, 0.05);
 
-    /* glColor3fv( color ); */
-    /* glutSolidSphere(1.0, 25, 25); */
-    glCallList(sun);
+    /* xglColor3fv( color ); */
+    /* xglutSolidSphere(1.0, 25, 25); */
+    xglCallList(sun_obj);
 
-    glPopMatrix();
+    xglPopMatrix();
 
-    glEnable( GL_LIGHTING );
+    xglEnable( GL_LIGHTING );
 }
 
 
 /* $Log$
-/* Revision 1.3  1997/12/09 05:11:56  curt
-/* Working on tweaking lighting.
+/* 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 {}"
+ *
+ * Revision 1.3  1997/12/09 05:11:56  curt
+ * Working on tweaking lighting.
+ *
  * Revision 1.2  1997/11/25 19:25:39  curt
  * Changes to integrate Durk's moon/sun code updates + clean up.
  *