got one fo the cube's normals wrong
[freeglut] / src / fg_geometry.c
index 583b544..a1d683d 100644 (file)
@@ -126,9 +126,9 @@ static GLdouble cube_v[CUBE_NUM_VERT][3] =
 /* Normal Vectors */
 static GLdouble cube_n[CUBE_NUM_FACES][3] =
 {
+    { 0.0, 0.0, 1.0},
     { 1.0, 0.0, 0.0},
     { 0.0, 1.0, 0.0},
-    { 0.0, 0.0, 1.0},
     {-1.0, 0.0, 0.0},
     { 0.0,-1.0, 0.0},
     { 0.0, 0.0,-1.0}
@@ -181,7 +181,7 @@ static void fghCubeGenerate()
 #define TETR_VERT_ELEM_PER_TETR TETR_VERT_PER_TETR*3
 
 /* Vertex Coordinates */
-static GLdouble tet_r[TETR_NUM_VERT][TETR_NUM_VERT_PER_FACE] =
+static GLdouble tet_r[TETR_NUM_VERT][3] =
 {
     {             1.0,             0.0,             0.0 },
     { -0.333333333333,  0.942809041582,             0.0 },
@@ -328,7 +328,10 @@ static void fghCircleTable(double **sint,double **cost,const int n)
 static void fghCube( GLdouble dSize, GLboolean useWireMode )
 {
     if (!cubeCached)
+    {
         fghCubeGenerate();
+        cubeCached = TRUE;
+    }
 
     if (dSize!=1.)
     {
@@ -342,7 +345,10 @@ static void fghCube( GLdouble dSize, GLboolean useWireMode )
 static void fghTetrahedron( GLboolean useWireMode )
 {
     if (!tetrCached)
+    {
         fghTetrahedronGenerate();
+        tetrCached = TRUE;
+    }
 
     fghDrawGeometry(GL_TRIANGLES,tetr_verts,tetr_norms,TETR_VERT_PER_TETR,useWireMode);
 }