Numerous style normalizations from John:

* Convert "return( value );" to "return value;"
 * Normalize spacing around semicolons.
 * Remove extraneous parens.
 * Split multi-statement lines into multiple lines.  (Mostly things
   of the form: "if( condition ) return;".)


git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@361 7f0cb862-5218-0410-a997-914c9d46530a
This commit is contained in:
rkrolib 2003-11-21 21:15:58 +00:00
parent 7e7ff3191d
commit 354569a7c4
11 changed files with 406 additions and 402 deletions

View File

@ -62,18 +62,21 @@ extern SFG_StrokeFont fgStrokeMonoRoman;
*/ */
static SFG_Font* fghFontByID( void* font ) static SFG_Font* fghFontByID( void* font )
{ {
/* if( font == GLUT_BITMAP_8_BY_13 )
* XXX Use a macro, a table of some kind, or else split these return &fgFontFixed8x13;
* XXX statements properly. Jamming "return" on the end of an if( font == GLUT_BITMAP_9_BY_15 )
* XXX "if" is just bad style, IMHO. return &fgFontFixed9x15;
*/ if( font == GLUT_BITMAP_HELVETICA_10 )
if( font == GLUT_BITMAP_8_BY_13 ) return &fgFontFixed8x13; return &fgFontHelvetica10;
if( font == GLUT_BITMAP_9_BY_15 ) return &fgFontFixed9x15; if( font == GLUT_BITMAP_HELVETICA_12 )
if( font == GLUT_BITMAP_HELVETICA_10 ) return &fgFontHelvetica10; return &fgFontHelvetica12;
if( font == GLUT_BITMAP_HELVETICA_12 ) return &fgFontHelvetica12; if( font == GLUT_BITMAP_HELVETICA_18 )
if( font == GLUT_BITMAP_HELVETICA_18 ) return &fgFontHelvetica18; return &fgFontHelvetica18;
if( font == GLUT_BITMAP_TIMES_ROMAN_10 ) return &fgFontTimesRoman10; if( font == GLUT_BITMAP_TIMES_ROMAN_10 )
if( font == GLUT_BITMAP_TIMES_ROMAN_24 ) return &fgFontTimesRoman24; return &fgFontTimesRoman10;
if( font == GLUT_BITMAP_TIMES_ROMAN_24 )
return &fgFontTimesRoman24;
fgError( "font 0x%08x not found", font ); fgError( "font 0x%08x not found", font );
return 0; /*** NOT REACHED ***/ return 0; /*** NOT REACHED ***/
} }
@ -84,12 +87,11 @@ static SFG_Font* fghFontByID( void* font )
*/ */
static SFG_StrokeFont* fghStrokeByID( void* font ) static SFG_StrokeFont* fghStrokeByID( void* font )
{ {
/* if( font == GLUT_STROKE_ROMAN )
* XXX Same comment as above about jamming "return" in after an return &fgStrokeRoman;
* XXX "if". if( font == GLUT_STROKE_MONO_ROMAN )
*/ return &fgStrokeMonoRoman;
if( font == GLUT_STROKE_ROMAN ) return &fgStrokeRoman;
if( font == GLUT_STROKE_MONO_ROMAN ) return &fgStrokeMonoRoman;
fgError( "stroke font 0x%08x not found", font ); fgError( "stroke font 0x%08x not found", font );
return 0; /*** NOT REACHED ***/ return 0; /*** NOT REACHED ***/
} }

View File

@ -138,15 +138,15 @@ void FGAPIENTRY glutWireSphere( GLdouble dRadius, GLint slices, GLint stacks )
for( j=0; j<stacks-1; j++ ) for( j=0; j<stacks-1; j++ )
{ {
cpsi = cos ( psi ) ; cpsi = cos ( psi );
spsi = sin ( psi ) ; spsi = sin ( psi );
phi = 0.0; phi = 0.0;
for( i=0; i<slices; i++ ) for( i=0; i<slices; i++ )
{ {
int offset = 3 * ( j * slices + i ) ; int offset = 3 * ( j * slices + i );
cphi = cos ( phi ) ; cphi = cos ( phi );
sphi = sin ( phi ) ; sphi = sin ( phi );
*(vertex + offset + 0) = sphi * spsi ; *(vertex + offset + 0) = sphi * spsi ;
*(vertex + offset + 1) = cphi * spsi ; *(vertex + offset + 1) = cphi * spsi ;
*(vertex + offset + 2) = cpsi ; *(vertex + offset + 2) = cpsi ;
@ -164,7 +164,7 @@ void FGAPIENTRY glutWireSphere( GLdouble dRadius, GLint slices, GLint stacks )
for( j=0; j<stacks - 1; j++ ) for( j=0; j<stacks - 1; j++ )
{ {
int offset = 3 * ( j * slices + i ) ; int offset = 3 * ( j * slices + i );
glNormal3dv( vertex + offset ); glNormal3dv( vertex + offset );
glVertex3dv( vertex + offset ); glVertex3dv( vertex + offset );
} }
@ -180,7 +180,7 @@ void FGAPIENTRY glutWireSphere( GLdouble dRadius, GLint slices, GLint stacks )
for( i=0; i<slices; i++ ) for( i=0; i<slices; i++ )
{ {
int offset = 3 * ( j * slices + i ) ; int offset = 3 * ( j * slices + i );
glNormal3dv( vertex + offset ); glNormal3dv( vertex + offset );
glVertex3dv( vertex + offset ); glVertex3dv( vertex + offset );
} }
@ -242,8 +242,8 @@ void FGAPIENTRY glutSolidSphere( GLdouble dRadius, GLint slices, GLint stacks )
{ {
phi = 0.0; phi = 0.0;
psi += dpsi; psi += dpsi;
cpsi = cos ( psi ) ; cpsi = cos ( psi );
spsi = sin ( psi ) ; spsi = sin ( psi );
/* get coords */ /* get coords */
glBegin( GL_QUAD_STRIP ); glBegin( GL_QUAD_STRIP );
@ -251,8 +251,8 @@ void FGAPIENTRY glutSolidSphere( GLdouble dRadius, GLint slices, GLint stacks )
/* glBegin(GL_LINE_LOOP); */ /* glBegin(GL_LINE_LOOP); */
for( i=0; i<slices; i++ ) for( i=0; i<slices; i++ )
{ {
cphi = cos ( phi ) ; cphi = cos ( phi );
sphi = sin ( phi ) ; sphi = sin ( phi );
next[ i * 3 + 0 ] = sphi * spsi ; next[ i * 3 + 0 ] = sphi * spsi ;
next[ i * 3 + 1 ] = cphi * spsi ; next[ i * 3 + 1 ] = cphi * spsi ;
next[ i * 3 + 2 ] = cpsi ; next[ i * 3 + 2 ] = cpsi ;
@ -318,8 +318,8 @@ void FGAPIENTRY glutWireCone( GLdouble base, GLdouble height, GLint slices, GLin
double angle = M_PI / (double) slices * 2.0; double angle = M_PI / (double) slices * 2.0;
double slope = ( height / base ); double slope = ( height / base );
double sBase = base ; double sBase = base ;
double sinNormal = ( base / sqrt ( height * height + base * base )) ; double sinNormal = ( base / sqrt ( height * height + base * base ));
double cosNormal = ( height / sqrt ( height * height + base * base )) ; double cosNormal = ( height / sqrt ( height * height + base * base ));
double *vertices = NULL; double *vertices = NULL;
int i, j; int i, j;
@ -360,18 +360,18 @@ void FGAPIENTRY glutWireCone( GLdouble base, GLdouble height, GLint slices, GLin
for( j=0; j<slices; j++ ) for( j=0; j<slices; j++ )
{ {
glBegin( GL_LINE_LOOP ); glBegin( GL_LINE_LOOP );
glNormal3d( sinNormal * vertices[(j+0)*2+0], sinNormal * vertices[(j+0)*2+1], cosNormal ) ; glNormal3d( sinNormal * vertices[(j+0)*2+0], sinNormal * vertices[(j+0)*2+1], cosNormal );
glVertex3d( vertices[(j+0)*2+0] * scl_a, vertices[(j+0)*2+1] * scl_a, alt_a ); glVertex3d( vertices[(j+0)*2+0] * scl_a, vertices[(j+0)*2+1] * scl_a, alt_a );
glNormal3d( sinNormal * vertices[(j+1)*2+0], sinNormal * vertices[(j+1)*2+1], cosNormal ) ; glNormal3d( sinNormal * vertices[(j+1)*2+0], sinNormal * vertices[(j+1)*2+1], cosNormal );
glVertex3d( vertices[(j+1)*2+0] * scl_a, vertices[(j+1)*2+1] * scl_a, alt_a ); glVertex3d( vertices[(j+1)*2+0] * scl_a, vertices[(j+1)*2+1] * scl_a, alt_a );
glNormal3d( sinNormal * vertices[(j+0)*2+0], sinNormal * vertices[(j+0)*2+1], cosNormal ) ; glNormal3d( sinNormal * vertices[(j+0)*2+0], sinNormal * vertices[(j+0)*2+1], cosNormal );
glVertex3d( vertices[(j+0)*2+0] * scl_b, vertices[(j+0)*2+1] * scl_b, alt_b ); glVertex3d( vertices[(j+0)*2+0] * scl_b, vertices[(j+0)*2+1] * scl_b, alt_b );
glEnd(); glEnd();
glBegin( GL_LINE_LOOP ); glBegin( GL_LINE_LOOP );
glNormal3d( sinNormal * vertices[(j+0)*2+0], sinNormal * vertices[(j+0)*2+1], cosNormal ) ; glNormal3d( sinNormal * vertices[(j+0)*2+0], sinNormal * vertices[(j+0)*2+1], cosNormal );
glVertex3d( vertices[(j+0)*2+0] * scl_b, vertices[(j+0)*2+1] * scl_b, alt_b ); glVertex3d( vertices[(j+0)*2+0] * scl_b, vertices[(j+0)*2+1] * scl_b, alt_b );
glNormal3d( sinNormal * vertices[(j+1)*2+0], sinNormal * vertices[(j+1)*2+1], cosNormal ) ; glNormal3d( sinNormal * vertices[(j+1)*2+0], sinNormal * vertices[(j+1)*2+1], cosNormal );
glVertex3d( vertices[(j+1)*2+0] * scl_b, vertices[(j+1)*2+1] * scl_b, alt_b ); glVertex3d( vertices[(j+1)*2+0] * scl_b, vertices[(j+1)*2+1] * scl_b, alt_b );
glVertex3d( vertices[(j+1)*2+0] * scl_a, vertices[(j+1)*2+1] * scl_a, alt_a ); glVertex3d( vertices[(j+1)*2+0] * scl_a, vertices[(j+1)*2+1] * scl_a, alt_a );
glEnd(); glEnd();
@ -386,9 +386,9 @@ void FGAPIENTRY glutWireCone( GLdouble base, GLdouble height, GLint slices, GLin
double scl = alt / slope; double scl = alt / slope;
glBegin( GL_LINE_LOOP ); glBegin( GL_LINE_LOOP );
glNormal3d( sinNormal * vertices[(j+0)*2+0], sinNormal * vertices[(j+0)*2+1], cosNormal ) ; glNormal3d( sinNormal * vertices[(j+0)*2+0], sinNormal * vertices[(j+0)*2+1], cosNormal );
glVertex3d( vertices[ (j+0)*2+0 ] * scl, vertices[ (j+0)*2+1 ] * scl, height - alt ); glVertex3d( vertices[ (j+0)*2+0 ] * scl, vertices[ (j+0)*2+1 ] * scl, height - alt );
glNormal3d( sinNormal * vertices[(j+1)*2+0], sinNormal * vertices[(j+1)*2+1], cosNormal ) ; glNormal3d( sinNormal * vertices[(j+1)*2+0], sinNormal * vertices[(j+1)*2+1], cosNormal );
glVertex3d( vertices[ (j+1)*2+0 ] * scl, vertices[ (j+1)*2+1 ] * scl, height - alt ); glVertex3d( vertices[ (j+1)*2+0 ] * scl, vertices[ (j+1)*2+1 ] * scl, height - alt );
glVertex3d( 0, 0, height ); glVertex3d( 0, 0, height );
glEnd(); glEnd();
@ -404,8 +404,8 @@ void FGAPIENTRY glutSolidCone( GLdouble base, GLdouble height, GLint slices, GLi
double angle = M_PI / (double) slices * 2.0f; double angle = M_PI / (double) slices * 2.0f;
double slope = ( height / base ); double slope = ( height / base );
double sBase = base ; double sBase = base ;
double sinNormal = ( base / sqrt ( height * height + base * base )) ; double sinNormal = ( base / sqrt ( height * height + base * base ));
double cosNormal = ( height / sqrt ( height * height + base * base )) ; double cosNormal = ( height / sqrt ( height * height + base * base ));
double *vertices = NULL; double *vertices = NULL;
int i, j; int i, j;
@ -446,18 +446,18 @@ void FGAPIENTRY glutSolidCone( GLdouble base, GLdouble height, GLint slices, GLi
for( j=0; j<slices; j++ ) for( j=0; j<slices; j++ )
{ {
glBegin( GL_TRIANGLES ); glBegin( GL_TRIANGLES );
glNormal3d( sinNormal * vertices[(j+0)*2+0], sinNormal * vertices[(j+0)*2+1], cosNormal ) ; glNormal3d( sinNormal * vertices[(j+0)*2+0], sinNormal * vertices[(j+0)*2+1], cosNormal );
glVertex3d( vertices[(j+0)*2+0] * scl_a, vertices[(j+0)*2+1] * scl_a, alt_a ); glVertex3d( vertices[(j+0)*2+0] * scl_a, vertices[(j+0)*2+1] * scl_a, alt_a );
glNormal3d( sinNormal * vertices[(j+1)*2+0], sinNormal * vertices[(j+1)*2+1], cosNormal ) ; glNormal3d( sinNormal * vertices[(j+1)*2+0], sinNormal * vertices[(j+1)*2+1], cosNormal );
glVertex3d( vertices[(j+1)*2+0] * scl_a, vertices[(j+1)*2+1] * scl_a, alt_a ); glVertex3d( vertices[(j+1)*2+0] * scl_a, vertices[(j+1)*2+1] * scl_a, alt_a );
glNormal3d( sinNormal * vertices[(j+0)*2+0], sinNormal * vertices[(j+0)*2+1], cosNormal ) ; glNormal3d( sinNormal * vertices[(j+0)*2+0], sinNormal * vertices[(j+0)*2+1], cosNormal );
glVertex3d( vertices[(j+0)*2+0] * scl_b, vertices[(j+0)*2+1] * scl_b, alt_b ); glVertex3d( vertices[(j+0)*2+0] * scl_b, vertices[(j+0)*2+1] * scl_b, alt_b );
glEnd(); glEnd();
glBegin( GL_TRIANGLES ); glBegin( GL_TRIANGLES );
glNormal3d( sinNormal * vertices[(j+0)*2+0], sinNormal * vertices[(j+0)*2+1], cosNormal ) ; glNormal3d( sinNormal * vertices[(j+0)*2+0], sinNormal * vertices[(j+0)*2+1], cosNormal );
glVertex3d( vertices[(j+0)*2+0] * scl_b, vertices[(j+0)*2+1] * scl_b, alt_b ); glVertex3d( vertices[(j+0)*2+0] * scl_b, vertices[(j+0)*2+1] * scl_b, alt_b );
glNormal3d( sinNormal * vertices[(j+1)*2+0], sinNormal * vertices[(j+1)*2+1], cosNormal ) ; glNormal3d( sinNormal * vertices[(j+1)*2+0], sinNormal * vertices[(j+1)*2+1], cosNormal );
glVertex3d( vertices[(j+1)*2+0] * scl_b, vertices[(j+1)*2+1] * scl_b, alt_b ); glVertex3d( vertices[(j+1)*2+0] * scl_b, vertices[(j+1)*2+1] * scl_b, alt_b );
glVertex3d( vertices[(j+1)*2+0] * scl_a, vertices[(j+1)*2+1] * scl_a, alt_a ); glVertex3d( vertices[(j+1)*2+0] * scl_a, vertices[(j+1)*2+1] * scl_a, alt_a );
glEnd(); glEnd();
@ -472,9 +472,9 @@ void FGAPIENTRY glutSolidCone( GLdouble base, GLdouble height, GLint slices, GLi
double scl = alt / slope; double scl = alt / slope;
glBegin( GL_TRIANGLES ); glBegin( GL_TRIANGLES );
glNormal3d( sinNormal * vertices[(j+0)*2+0], sinNormal * vertices[(j+0)*2+1], cosNormal ) ; glNormal3d( sinNormal * vertices[(j+0)*2+0], sinNormal * vertices[(j+0)*2+1], cosNormal );
glVertex3d( vertices[ (j+0)*2+0 ] * scl, vertices[ (j+0)*2+1 ] * scl, height - alt ); glVertex3d( vertices[ (j+0)*2+0 ] * scl, vertices[ (j+0)*2+1 ] * scl, height - alt );
glNormal3d( sinNormal * vertices[(j+1)*2+0], sinNormal * vertices[(j+1)*2+1], cosNormal ) ; glNormal3d( sinNormal * vertices[(j+1)*2+0], sinNormal * vertices[(j+1)*2+1], cosNormal );
glVertex3d( vertices[ (j+1)*2+0 ] * scl, vertices[ (j+1)*2+1 ] * scl, height - alt ); glVertex3d( vertices[ (j+1)*2+0 ] * scl, vertices[ (j+1)*2+1 ] * scl, height - alt );
glVertex3d( 0, 0, height ); glVertex3d( 0, 0, height );
glEnd(); glEnd();
@ -505,21 +505,21 @@ void FGAPIENTRY glutWireTorus( GLdouble dInnerRadius, GLdouble dOuterRadius, GLi
for( j=0; j<nRings; j++ ) for( j=0; j<nRings; j++ )
{ {
cpsi = cos ( psi ) ; cpsi = cos ( psi );
spsi = sin ( psi ) ; spsi = sin ( psi );
phi = 0.0; phi = 0.0;
for( i=0; i<nSides; i++ ) for( i=0; i<nSides; i++ )
{ {
int offset = 3 * ( j * nSides + i ) ; int offset = 3 * ( j * nSides + i );
cphi = cos ( phi ) ; cphi = cos ( phi );
sphi = sin ( phi ) ; sphi = sin ( phi );
*(vertex + offset + 0) = cpsi * ( oradius + cphi * iradius ) ; *(vertex + offset + 0) = cpsi * ( oradius + cphi * iradius );
*(vertex + offset + 1) = spsi * ( oradius + cphi * iradius ) ; *(vertex + offset + 1) = spsi * ( oradius + cphi * iradius );
*(vertex + offset + 2) = sphi * iradius ; *(vertex + offset + 2) = sphi * iradius ;
*(normal + offset + 0) = cpsi * cphi ; *(normal + offset + 0) = cpsi * cphi;
*(normal + offset + 1) = spsi * cphi ; *(normal + offset + 1) = spsi * cphi;
*(normal + offset + 2) = sphi ; *(normal + offset + 2) = sphi;
phi += dphi; phi += dphi;
} }
@ -532,7 +532,7 @@ void FGAPIENTRY glutWireTorus( GLdouble dInnerRadius, GLdouble dOuterRadius, GLi
for( j=0; j<nRings; j++ ) for( j=0; j<nRings; j++ )
{ {
int offset = 3 * ( j * nSides + i ) ; int offset = 3 * ( j * nSides + i );
glNormal3dv( normal + offset ); glNormal3dv( normal + offset );
glVertex3dv( vertex + offset ); glVertex3dv( vertex + offset );
} }
@ -546,7 +546,7 @@ void FGAPIENTRY glutWireTorus( GLdouble dInnerRadius, GLdouble dOuterRadius, GLi
for( i=0; i<nSides; i++ ) for( i=0; i<nSides; i++ )
{ {
int offset = 3 * ( j * nSides + i ) ; int offset = 3 * ( j * nSides + i );
glNormal3dv( normal + offset ); glNormal3dv( normal + offset );
glVertex3dv( vertex + offset ); glVertex3dv( vertex + offset );
} }
@ -554,8 +554,8 @@ void FGAPIENTRY glutWireTorus( GLdouble dInnerRadius, GLdouble dOuterRadius, GLi
glEnd(); glEnd();
} }
free ( vertex ) ; free ( vertex );
free ( normal ) ; free ( normal );
glPopMatrix(); glPopMatrix();
} }
@ -572,8 +572,8 @@ void FGAPIENTRY glutSolidTorus( GLdouble dInnerRadius, GLdouble dOuterRadius, GL
/* /*
* Increment the number of sides and rings to allow for one more point than surface * Increment the number of sides and rings to allow for one more point than surface
*/ */
nSides ++ ; nSides ++;
nRings ++ ; nRings ++;
/* /*
* Allocate the vertices array * Allocate the vertices array
@ -583,27 +583,27 @@ void FGAPIENTRY glutSolidTorus( GLdouble dInnerRadius, GLdouble dOuterRadius, GL
glPushMatrix(); glPushMatrix();
dpsi = 2.0 * M_PI / (double)(nRings - 1) ; dpsi = 2.0 * M_PI / (double)(nRings - 1);
dphi = 2.0 * M_PI / (double)(nSides - 1) ; dphi = 2.0 * M_PI / (double)(nSides - 1);
psi = 0.0; psi = 0.0;
for( j=0; j<nRings; j++ ) for( j=0; j<nRings; j++ )
{ {
cpsi = cos ( psi ) ; cpsi = cos ( psi );
spsi = sin ( psi ) ; spsi = sin ( psi );
phi = 0.0; phi = 0.0;
for( i=0; i<nSides; i++ ) for( i=0; i<nSides; i++ )
{ {
int offset = 3 * ( j * nSides + i ) ; int offset = 3 * ( j * nSides + i );
cphi = cos ( phi ) ; cphi = cos ( phi );
sphi = sin ( phi ) ; sphi = sin ( phi );
*(vertex + offset + 0) = cpsi * ( oradius + cphi * iradius ) ; *(vertex + offset + 0) = cpsi * ( oradius + cphi * iradius );
*(vertex + offset + 1) = spsi * ( oradius + cphi * iradius ) ; *(vertex + offset + 1) = spsi * ( oradius + cphi * iradius );
*(vertex + offset + 2) = sphi * iradius ; *(vertex + offset + 2) = sphi * iradius ;
*(normal + offset + 0) = cpsi * cphi ; *(normal + offset + 0) = cpsi * cphi;
*(normal + offset + 1) = spsi * cphi ; *(normal + offset + 1) = spsi * cphi;
*(normal + offset + 2) = sphi ; *(normal + offset + 2) = sphi;
phi += dphi; phi += dphi;
} }
@ -615,7 +615,7 @@ void FGAPIENTRY glutSolidTorus( GLdouble dInnerRadius, GLdouble dOuterRadius, GL
{ {
for( j=0; j<nRings-1; j++ ) for( j=0; j<nRings-1; j++ )
{ {
int offset = 3 * ( j * nSides + i ) ; int offset = 3 * ( j * nSides + i );
glNormal3dv( normal + offset ); glNormal3dv( normal + offset );
glVertex3dv( vertex + offset ); glVertex3dv( vertex + offset );
glNormal3dv( normal + offset + 3 ); glNormal3dv( normal + offset + 3 );
@ -629,8 +629,8 @@ void FGAPIENTRY glutSolidTorus( GLdouble dInnerRadius, GLdouble dOuterRadius, GL
glEnd(); glEnd();
free ( vertex ) ; free ( vertex );
free ( normal ) ; free ( normal );
glPopMatrix(); glPopMatrix();
} }
@ -644,44 +644,44 @@ void FGAPIENTRY glutWireDodecahedron( void )
* (+-x,0, z); (+-1, 1, 1); (0, z, x ) * (+-x,0, z); (+-1, 1, 1); (0, z, x )
* where x = 0.61803398875 and z = 1.61803398875. * where x = 0.61803398875 and z = 1.61803398875.
*/ */
glBegin ( GL_LINE_LOOP ) ; glBegin ( GL_LINE_LOOP );
glNormal3d ( 0.0, 0.525731112119, 0.850650808354 ) ; glVertex3d ( 0.0, 1.61803398875, 0.61803398875 ) ; glVertex3d ( -1.0, 1.0, 1.0 ) ; glVertex3d ( -0.61803398875, 0.0, 1.61803398875 ) ; glVertex3d ( 0.61803398875, 0.0, 1.61803398875 ) ; glVertex3d ( 1.0, 1.0, 1.0 ) ; glNormal3d ( 0.0, 0.525731112119, 0.850650808354 ); glVertex3d ( 0.0, 1.61803398875, 0.61803398875 ); glVertex3d ( -1.0, 1.0, 1.0 ); glVertex3d ( -0.61803398875, 0.0, 1.61803398875 ); glVertex3d ( 0.61803398875, 0.0, 1.61803398875 ); glVertex3d ( 1.0, 1.0, 1.0 );
glEnd () ; glEnd ();
glBegin ( GL_LINE_LOOP ) ; glBegin ( GL_LINE_LOOP );
glNormal3d ( 0.0, 0.525731112119, -0.850650808354 ) ; glVertex3d ( 0.0, 1.61803398875, -0.61803398875 ) ; glVertex3d ( 1.0, 1.0, -1.0 ) ; glVertex3d ( 0.61803398875, 0.0, -1.61803398875 ) ; glVertex3d ( -0.61803398875, 0.0, -1.61803398875 ) ; glVertex3d ( -1.0, 1.0, -1.0 ) ; glNormal3d ( 0.0, 0.525731112119, -0.850650808354 ); glVertex3d ( 0.0, 1.61803398875, -0.61803398875 ); glVertex3d ( 1.0, 1.0, -1.0 ); glVertex3d ( 0.61803398875, 0.0, -1.61803398875 ); glVertex3d ( -0.61803398875, 0.0, -1.61803398875 ); glVertex3d ( -1.0, 1.0, -1.0 );
glEnd () ; glEnd ();
glBegin ( GL_LINE_LOOP ) ; glBegin ( GL_LINE_LOOP );
glNormal3d ( 0.0, -0.525731112119, 0.850650808354 ) ; glVertex3d ( 0.0, -1.61803398875, 0.61803398875 ) ; glVertex3d ( 1.0, -1.0, 1.0 ) ; glVertex3d ( 0.61803398875, 0.0, 1.61803398875 ) ; glVertex3d ( -0.61803398875, 0.0, 1.61803398875 ) ; glVertex3d ( -1.0, -1.0, 1.0 ) ; glNormal3d ( 0.0, -0.525731112119, 0.850650808354 ); glVertex3d ( 0.0, -1.61803398875, 0.61803398875 ); glVertex3d ( 1.0, -1.0, 1.0 ); glVertex3d ( 0.61803398875, 0.0, 1.61803398875 ); glVertex3d ( -0.61803398875, 0.0, 1.61803398875 ); glVertex3d ( -1.0, -1.0, 1.0 );
glEnd () ; glEnd ();
glBegin ( GL_LINE_LOOP ) ; glBegin ( GL_LINE_LOOP );
glNormal3d ( 0.0, -0.525731112119, -0.850650808354 ) ; glVertex3d ( 0.0, -1.61803398875, -0.61803398875 ) ; glVertex3d ( -1.0, -1.0, -1.0 ) ; glVertex3d ( -0.61803398875, 0.0, -1.61803398875 ) ; glVertex3d ( 0.61803398875, 0.0, -1.61803398875 ) ; glVertex3d ( 1.0, -1.0, -1.0 ) ; glNormal3d ( 0.0, -0.525731112119, -0.850650808354 ); glVertex3d ( 0.0, -1.61803398875, -0.61803398875 ); glVertex3d ( -1.0, -1.0, -1.0 ); glVertex3d ( -0.61803398875, 0.0, -1.61803398875 ); glVertex3d ( 0.61803398875, 0.0, -1.61803398875 ); glVertex3d ( 1.0, -1.0, -1.0 );
glEnd () ; glEnd ();
glBegin ( GL_LINE_LOOP ) ; glBegin ( GL_LINE_LOOP );
glNormal3d ( 0.850650808354, 0.0, 0.525731112119 ) ; glVertex3d ( 0.61803398875, 0.0, 1.61803398875 ) ; glVertex3d ( 1.0, -1.0, 1.0 ) ; glVertex3d ( 1.61803398875, -0.61803398875, 0.0 ) ; glVertex3d ( 1.61803398875, 0.61803398875, 0.0 ) ; glVertex3d ( 1.0, 1.0, 1.0 ) ; glNormal3d ( 0.850650808354, 0.0, 0.525731112119 ); glVertex3d ( 0.61803398875, 0.0, 1.61803398875 ); glVertex3d ( 1.0, -1.0, 1.0 ); glVertex3d ( 1.61803398875, -0.61803398875, 0.0 ); glVertex3d ( 1.61803398875, 0.61803398875, 0.0 ); glVertex3d ( 1.0, 1.0, 1.0 );
glEnd () ; glEnd ();
glBegin ( GL_LINE_LOOP ) ; glBegin ( GL_LINE_LOOP );
glNormal3d ( -0.850650808354, 0.0, 0.525731112119 ) ; glVertex3d ( -0.61803398875, 0.0, 1.61803398875 ) ; glVertex3d ( -1.0, 1.0, 1.0 ) ; glVertex3d ( -1.61803398875, 0.61803398875, 0.0 ) ; glVertex3d ( -1.61803398875, -0.61803398875, 0.0 ) ; glVertex3d ( -1.0, -1.0, 1.0 ) ; glNormal3d ( -0.850650808354, 0.0, 0.525731112119 ); glVertex3d ( -0.61803398875, 0.0, 1.61803398875 ); glVertex3d ( -1.0, 1.0, 1.0 ); glVertex3d ( -1.61803398875, 0.61803398875, 0.0 ); glVertex3d ( -1.61803398875, -0.61803398875, 0.0 ); glVertex3d ( -1.0, -1.0, 1.0 );
glEnd () ; glEnd ();
glBegin ( GL_LINE_LOOP ) ; glBegin ( GL_LINE_LOOP );
glNormal3d ( 0.850650808354, 0.0, -0.525731112119 ) ; glVertex3d ( 0.61803398875, 0.0, -1.61803398875 ) ; glVertex3d ( 1.0, 1.0, -1.0 ) ; glVertex3d ( 1.61803398875, 0.61803398875, 0.0 ) ; glVertex3d ( 1.61803398875, -0.61803398875, 0.0 ) ; glVertex3d ( 1.0, -1.0, -1.0 ) ; glNormal3d ( 0.850650808354, 0.0, -0.525731112119 ); glVertex3d ( 0.61803398875, 0.0, -1.61803398875 ); glVertex3d ( 1.0, 1.0, -1.0 ); glVertex3d ( 1.61803398875, 0.61803398875, 0.0 ); glVertex3d ( 1.61803398875, -0.61803398875, 0.0 ); glVertex3d ( 1.0, -1.0, -1.0 );
glEnd () ; glEnd ();
glBegin ( GL_LINE_LOOP ) ; glBegin ( GL_LINE_LOOP );
glNormal3d ( -0.850650808354, 0.0, -0.525731112119 ) ; glVertex3d ( -0.61803398875, 0.0, -1.61803398875 ) ; glVertex3d ( -1.0, -1.0, -1.0 ) ; glVertex3d ( -1.61803398875, -0.61803398875, 0.0 ) ; glVertex3d ( -1.61803398875, 0.61803398875, 0.0 ) ; glVertex3d ( -1.0, 1.0, -1.0 ) ; glNormal3d ( -0.850650808354, 0.0, -0.525731112119 ); glVertex3d ( -0.61803398875, 0.0, -1.61803398875 ); glVertex3d ( -1.0, -1.0, -1.0 ); glVertex3d ( -1.61803398875, -0.61803398875, 0.0 ); glVertex3d ( -1.61803398875, 0.61803398875, 0.0 ); glVertex3d ( -1.0, 1.0, -1.0 );
glEnd () ; glEnd ();
glBegin ( GL_LINE_LOOP ) ; glBegin ( GL_LINE_LOOP );
glNormal3d ( 0.525731112119, 0.850650808354, 0.0 ) ; glVertex3d ( 1.61803398875, 0.61803398875, 0.0 ) ; glVertex3d ( 1.0, 1.0, -1.0 ) ; glVertex3d ( 0.0, 1.61803398875, -0.61803398875 ) ; glVertex3d ( 0.0, 1.61803398875, 0.61803398875 ) ; glVertex3d ( 1.0, 1.0, 1.0 ) ; glNormal3d ( 0.525731112119, 0.850650808354, 0.0 ); glVertex3d ( 1.61803398875, 0.61803398875, 0.0 ); glVertex3d ( 1.0, 1.0, -1.0 ); glVertex3d ( 0.0, 1.61803398875, -0.61803398875 ); glVertex3d ( 0.0, 1.61803398875, 0.61803398875 ); glVertex3d ( 1.0, 1.0, 1.0 );
glEnd () ; glEnd ();
glBegin ( GL_LINE_LOOP ) ; glBegin ( GL_LINE_LOOP );
glNormal3d ( 0.525731112119, -0.850650808354, 0.0 ) ; glVertex3d ( 1.61803398875, -0.61803398875, 0.0 ) ; glVertex3d ( 1.0, -1.0, 1.0 ) ; glVertex3d ( 0.0, -1.61803398875, 0.61803398875 ) ; glVertex3d ( 0.0, -1.61803398875, -0.61803398875 ) ; glVertex3d ( 1.0, -1.0, -1.0 ) ; glNormal3d ( 0.525731112119, -0.850650808354, 0.0 ); glVertex3d ( 1.61803398875, -0.61803398875, 0.0 ); glVertex3d ( 1.0, -1.0, 1.0 ); glVertex3d ( 0.0, -1.61803398875, 0.61803398875 ); glVertex3d ( 0.0, -1.61803398875, -0.61803398875 ); glVertex3d ( 1.0, -1.0, -1.0 );
glEnd () ; glEnd ();
glBegin ( GL_LINE_LOOP ) ; glBegin ( GL_LINE_LOOP );
glNormal3d ( -0.525731112119, 0.850650808354, 0.0 ) ; glVertex3d ( -1.61803398875, 0.61803398875, 0.0 ) ; glVertex3d ( -1.0, 1.0, 1.0 ) ; glVertex3d ( 0.0, 1.61803398875, 0.61803398875 ) ; glVertex3d ( 0.0, 1.61803398875, -0.61803398875 ) ; glVertex3d ( -1.0, 1.0, -1.0 ) ; glNormal3d ( -0.525731112119, 0.850650808354, 0.0 ); glVertex3d ( -1.61803398875, 0.61803398875, 0.0 ); glVertex3d ( -1.0, 1.0, 1.0 ); glVertex3d ( 0.0, 1.61803398875, 0.61803398875 ); glVertex3d ( 0.0, 1.61803398875, -0.61803398875 ); glVertex3d ( -1.0, 1.0, -1.0 );
glEnd () ; glEnd ();
glBegin ( GL_LINE_LOOP ) ; glBegin ( GL_LINE_LOOP );
glNormal3d ( -0.525731112119, -0.850650808354, 0.0 ) ; glVertex3d ( -1.61803398875, -0.61803398875, 0.0 ) ; glVertex3d ( -1.0, -1.0, -1.0 ) ; glVertex3d ( 0.0, -1.61803398875, -0.61803398875 ) ; glVertex3d ( 0.0, -1.61803398875, 0.61803398875 ) ; glVertex3d ( -1.0, -1.0, 1.0 ) ; glNormal3d ( -0.525731112119, -0.850650808354, 0.0 ); glVertex3d ( -1.61803398875, -0.61803398875, 0.0 ); glVertex3d ( -1.0, -1.0, -1.0 ); glVertex3d ( 0.0, -1.61803398875, -0.61803398875 ); glVertex3d ( 0.0, -1.61803398875, 0.61803398875 ); glVertex3d ( -1.0, -1.0, 1.0 );
glEnd () ; glEnd ();
} }
/* /*
@ -694,44 +694,44 @@ void FGAPIENTRY glutSolidDodecahedron( void )
* (+-x,0, z); (+-1, 1, 1); (0, z, x ) * (+-x,0, z); (+-1, 1, 1); (0, z, x )
* where x = 0.61803398875 and z = 1.61803398875. * where x = 0.61803398875 and z = 1.61803398875.
*/ */
glBegin ( GL_POLYGON ) ; glBegin ( GL_POLYGON );
glNormal3d ( 0.0, 0.525731112119, 0.850650808354 ) ; glVertex3d ( 0.0, 1.61803398875, 0.61803398875 ) ; glVertex3d ( -1.0, 1.0, 1.0 ) ; glVertex3d ( -0.61803398875, 0.0, 1.61803398875 ) ; glVertex3d ( 0.61803398875, 0.0, 1.61803398875 ) ; glVertex3d ( 1.0, 1.0, 1.0 ) ; glNormal3d ( 0.0, 0.525731112119, 0.850650808354 ); glVertex3d ( 0.0, 1.61803398875, 0.61803398875 ); glVertex3d ( -1.0, 1.0, 1.0 ); glVertex3d ( -0.61803398875, 0.0, 1.61803398875 ); glVertex3d ( 0.61803398875, 0.0, 1.61803398875 ); glVertex3d ( 1.0, 1.0, 1.0 );
glEnd () ; glEnd ();
glBegin ( GL_POLYGON ) ; glBegin ( GL_POLYGON );
glNormal3d ( 0.0, 0.525731112119, -0.850650808354 ) ; glVertex3d ( 0.0, 1.61803398875, -0.61803398875 ) ; glVertex3d ( 1.0, 1.0, -1.0 ) ; glVertex3d ( 0.61803398875, 0.0, -1.61803398875 ) ; glVertex3d ( -0.61803398875, 0.0, -1.61803398875 ) ; glVertex3d ( -1.0, 1.0, -1.0 ) ; glNormal3d ( 0.0, 0.525731112119, -0.850650808354 ); glVertex3d ( 0.0, 1.61803398875, -0.61803398875 ); glVertex3d ( 1.0, 1.0, -1.0 ); glVertex3d ( 0.61803398875, 0.0, -1.61803398875 ); glVertex3d ( -0.61803398875, 0.0, -1.61803398875 ); glVertex3d ( -1.0, 1.0, -1.0 );
glEnd () ; glEnd ();
glBegin ( GL_POLYGON ) ; glBegin ( GL_POLYGON );
glNormal3d ( 0.0, -0.525731112119, 0.850650808354 ) ; glVertex3d ( 0.0, -1.61803398875, 0.61803398875 ) ; glVertex3d ( 1.0, -1.0, 1.0 ) ; glVertex3d ( 0.61803398875, 0.0, 1.61803398875 ) ; glVertex3d ( -0.61803398875, 0.0, 1.61803398875 ) ; glVertex3d ( -1.0, -1.0, 1.0 ) ; glNormal3d ( 0.0, -0.525731112119, 0.850650808354 ); glVertex3d ( 0.0, -1.61803398875, 0.61803398875 ); glVertex3d ( 1.0, -1.0, 1.0 ); glVertex3d ( 0.61803398875, 0.0, 1.61803398875 ); glVertex3d ( -0.61803398875, 0.0, 1.61803398875 ); glVertex3d ( -1.0, -1.0, 1.0 );
glEnd () ; glEnd ();
glBegin ( GL_POLYGON ) ; glBegin ( GL_POLYGON );
glNormal3d ( 0.0, -0.525731112119, -0.850650808354 ) ; glVertex3d ( 0.0, -1.61803398875, -0.61803398875 ) ; glVertex3d ( -1.0, -1.0, -1.0 ) ; glVertex3d ( -0.61803398875, 0.0, -1.61803398875 ) ; glVertex3d ( 0.61803398875, 0.0, -1.61803398875 ) ; glVertex3d ( 1.0, -1.0, -1.0 ) ; glNormal3d ( 0.0, -0.525731112119, -0.850650808354 ); glVertex3d ( 0.0, -1.61803398875, -0.61803398875 ); glVertex3d ( -1.0, -1.0, -1.0 ); glVertex3d ( -0.61803398875, 0.0, -1.61803398875 ); glVertex3d ( 0.61803398875, 0.0, -1.61803398875 ); glVertex3d ( 1.0, -1.0, -1.0 );
glEnd () ; glEnd ();
glBegin ( GL_POLYGON ) ; glBegin ( GL_POLYGON );
glNormal3d ( 0.850650808354, 0.0, 0.525731112119 ) ; glVertex3d ( 0.61803398875, 0.0, 1.61803398875 ) ; glVertex3d ( 1.0, -1.0, 1.0 ) ; glVertex3d ( 1.61803398875, -0.61803398875, 0.0 ) ; glVertex3d ( 1.61803398875, 0.61803398875, 0.0 ) ; glVertex3d ( 1.0, 1.0, 1.0 ) ; glNormal3d ( 0.850650808354, 0.0, 0.525731112119 ); glVertex3d ( 0.61803398875, 0.0, 1.61803398875 ); glVertex3d ( 1.0, -1.0, 1.0 ); glVertex3d ( 1.61803398875, -0.61803398875, 0.0 ); glVertex3d ( 1.61803398875, 0.61803398875, 0.0 ); glVertex3d ( 1.0, 1.0, 1.0 );
glEnd () ; glEnd ();
glBegin ( GL_POLYGON ) ; glBegin ( GL_POLYGON );
glNormal3d ( -0.850650808354, 0.0, 0.525731112119 ) ; glVertex3d ( -0.61803398875, 0.0, 1.61803398875 ) ; glVertex3d ( -1.0, 1.0, 1.0 ) ; glVertex3d ( -1.61803398875, 0.61803398875, 0.0 ) ; glVertex3d ( -1.61803398875, -0.61803398875, 0.0 ) ; glVertex3d ( -1.0, -1.0, 1.0 ) ; glNormal3d ( -0.850650808354, 0.0, 0.525731112119 ); glVertex3d ( -0.61803398875, 0.0, 1.61803398875 ); glVertex3d ( -1.0, 1.0, 1.0 ); glVertex3d ( -1.61803398875, 0.61803398875, 0.0 ); glVertex3d ( -1.61803398875, -0.61803398875, 0.0 ); glVertex3d ( -1.0, -1.0, 1.0 );
glEnd () ; glEnd ();
glBegin ( GL_POLYGON ) ; glBegin ( GL_POLYGON );
glNormal3d ( 0.850650808354, 0.0, -0.525731112119 ) ; glVertex3d ( 0.61803398875, 0.0, -1.61803398875 ) ; glVertex3d ( 1.0, 1.0, -1.0 ) ; glVertex3d ( 1.61803398875, 0.61803398875, 0.0 ) ; glVertex3d ( 1.61803398875, -0.61803398875, 0.0 ) ; glVertex3d ( 1.0, -1.0, -1.0 ) ; glNormal3d ( 0.850650808354, 0.0, -0.525731112119 ); glVertex3d ( 0.61803398875, 0.0, -1.61803398875 ); glVertex3d ( 1.0, 1.0, -1.0 ); glVertex3d ( 1.61803398875, 0.61803398875, 0.0 ); glVertex3d ( 1.61803398875, -0.61803398875, 0.0 ); glVertex3d ( 1.0, -1.0, -1.0 );
glEnd () ; glEnd ();
glBegin ( GL_POLYGON ) ; glBegin ( GL_POLYGON );
glNormal3d ( -0.850650808354, 0.0, -0.525731112119 ) ; glVertex3d ( -0.61803398875, 0.0, -1.61803398875 ) ; glVertex3d ( -1.0, -1.0, -1.0 ) ; glVertex3d ( -1.61803398875, -0.61803398875, 0.0 ) ; glVertex3d ( -1.61803398875, 0.61803398875, 0.0 ) ; glVertex3d ( -1.0, 1.0, -1.0 ) ; glNormal3d ( -0.850650808354, 0.0, -0.525731112119 ); glVertex3d ( -0.61803398875, 0.0, -1.61803398875 ); glVertex3d ( -1.0, -1.0, -1.0 ); glVertex3d ( -1.61803398875, -0.61803398875, 0.0 ); glVertex3d ( -1.61803398875, 0.61803398875, 0.0 ); glVertex3d ( -1.0, 1.0, -1.0 );
glEnd () ; glEnd ();
glBegin ( GL_POLYGON ) ; glBegin ( GL_POLYGON );
glNormal3d ( 0.525731112119, 0.850650808354, 0.0 ) ; glVertex3d ( 1.61803398875, 0.61803398875, 0.0 ) ; glVertex3d ( 1.0, 1.0, -1.0 ) ; glVertex3d ( 0.0, 1.61803398875, -0.61803398875 ) ; glVertex3d ( 0.0, 1.61803398875, 0.61803398875 ) ; glVertex3d ( 1.0, 1.0, 1.0 ) ; glNormal3d ( 0.525731112119, 0.850650808354, 0.0 ); glVertex3d ( 1.61803398875, 0.61803398875, 0.0 ); glVertex3d ( 1.0, 1.0, -1.0 ); glVertex3d ( 0.0, 1.61803398875, -0.61803398875 ); glVertex3d ( 0.0, 1.61803398875, 0.61803398875 ); glVertex3d ( 1.0, 1.0, 1.0 );
glEnd () ; glEnd ();
glBegin ( GL_POLYGON ) ; glBegin ( GL_POLYGON );
glNormal3d ( 0.525731112119, -0.850650808354, 0.0 ) ; glVertex3d ( 1.61803398875, -0.61803398875, 0.0 ) ; glVertex3d ( 1.0, -1.0, 1.0 ) ; glVertex3d ( 0.0, -1.61803398875, 0.61803398875 ) ; glVertex3d ( 0.0, -1.61803398875, -0.61803398875 ) ; glVertex3d ( 1.0, -1.0, -1.0 ) ; glNormal3d ( 0.525731112119, -0.850650808354, 0.0 ); glVertex3d ( 1.61803398875, -0.61803398875, 0.0 ); glVertex3d ( 1.0, -1.0, 1.0 ); glVertex3d ( 0.0, -1.61803398875, 0.61803398875 ); glVertex3d ( 0.0, -1.61803398875, -0.61803398875 ); glVertex3d ( 1.0, -1.0, -1.0 );
glEnd () ; glEnd ();
glBegin ( GL_POLYGON ) ; glBegin ( GL_POLYGON );
glNormal3d ( -0.525731112119, 0.850650808354, 0.0 ) ; glVertex3d ( -1.61803398875, 0.61803398875, 0.0 ) ; glVertex3d ( -1.0, 1.0, 1.0 ) ; glVertex3d ( 0.0, 1.61803398875, 0.61803398875 ) ; glVertex3d ( 0.0, 1.61803398875, -0.61803398875 ) ; glVertex3d ( -1.0, 1.0, -1.0 ) ; glNormal3d ( -0.525731112119, 0.850650808354, 0.0 ); glVertex3d ( -1.61803398875, 0.61803398875, 0.0 ); glVertex3d ( -1.0, 1.0, 1.0 ); glVertex3d ( 0.0, 1.61803398875, 0.61803398875 ); glVertex3d ( 0.0, 1.61803398875, -0.61803398875 ); glVertex3d ( -1.0, 1.0, -1.0 );
glEnd () ; glEnd ();
glBegin ( GL_POLYGON ) ; glBegin ( GL_POLYGON );
glNormal3d ( -0.525731112119, -0.850650808354, 0.0 ) ; glVertex3d ( -1.61803398875, -0.61803398875, 0.0 ) ; glVertex3d ( -1.0, -1.0, -1.0 ) ; glVertex3d ( 0.0, -1.61803398875, -0.61803398875 ) ; glVertex3d ( 0.0, -1.61803398875, 0.61803398875 ) ; glVertex3d ( -1.0, -1.0, 1.0 ) ; glNormal3d ( -0.525731112119, -0.850650808354, 0.0 ); glVertex3d ( -1.61803398875, -0.61803398875, 0.0 ); glVertex3d ( -1.0, -1.0, -1.0 ); glVertex3d ( 0.0, -1.61803398875, -0.61803398875 ); glVertex3d ( 0.0, -1.61803398875, 0.61803398875 ); glVertex3d ( -1.0, -1.0, 1.0 );
glEnd () ; glEnd ();
} }
/* /*
@ -787,17 +787,17 @@ void FGAPIENTRY glutWireTetrahedron( void )
* Normals: The unit normals are simply the negative of the coordinates of the point not on the surface. * Normals: The unit normals are simply the negative of the coordinates of the point not on the surface.
*/ */
double r0[3] = { 1.0, 0.0, 0.0 } ; double r0[3] = { 1.0, 0.0, 0.0 };
double r1[3] = { -0.333333333333, 0.942809041582, 0.0 } ; double r1[3] = { -0.333333333333, 0.942809041582, 0.0 };
double r2[3] = { -0.333333333333, -0.471404520791, 0.816496580928 } ; double r2[3] = { -0.333333333333, -0.471404520791, 0.816496580928 };
double r3[3] = { -0.333333333333, -0.471404520791, -0.816496580928 } ; double r3[3] = { -0.333333333333, -0.471404520791, -0.816496580928 };
glBegin( GL_LINE_LOOP ) ; glBegin( GL_LINE_LOOP );
glNormal3d ( -1.0, 0.0, 0.0 ) ; glVertex3dv ( r1 ) ; glVertex3dv ( r3 ) ; glVertex3dv ( r2 ) ; glNormal3d ( -1.0, 0.0, 0.0 ); glVertex3dv ( r1 ); glVertex3dv ( r3 ); glVertex3dv ( r2 );
glNormal3d ( 0.333333333333, -0.942809041582, 0.0 ) ; glVertex3dv ( r0 ) ; glVertex3dv ( r2 ) ; glVertex3dv ( r3 ) ; glNormal3d ( 0.333333333333, -0.942809041582, 0.0 ); glVertex3dv ( r0 ); glVertex3dv ( r2 ); glVertex3dv ( r3 );
glNormal3d ( 0.333333333333, 0.471404520791, -0.816496580928 ) ; glVertex3dv ( r0 ) ; glVertex3dv ( r3 ) ; glVertex3dv ( r1 ) ; glNormal3d ( 0.333333333333, 0.471404520791, -0.816496580928 ); glVertex3dv ( r0 ); glVertex3dv ( r3 ); glVertex3dv ( r1 );
glNormal3d ( 0.333333333333, 0.471404520791, 0.816496580928 ) ; glVertex3dv ( r0 ) ; glVertex3dv ( r1 ) ; glVertex3dv ( r2 ) ; glNormal3d ( 0.333333333333, 0.471404520791, 0.816496580928 ); glVertex3dv ( r0 ); glVertex3dv ( r1 ); glVertex3dv ( r2 );
glEnd() ; glEnd();
} }
/* /*
@ -815,17 +815,17 @@ void FGAPIENTRY glutSolidTetrahedron( void )
* Normals: The unit normals are simply the negative of the coordinates of the point not on the surface. * Normals: The unit normals are simply the negative of the coordinates of the point not on the surface.
*/ */
double r0[3] = { 1.0, 0.0, 0.0 } ; double r0[3] = { 1.0, 0.0, 0.0 };
double r1[3] = { -0.333333333333, 0.942809041582, 0.0 } ; double r1[3] = { -0.333333333333, 0.942809041582, 0.0 };
double r2[3] = { -0.333333333333, -0.471404520791, 0.816496580928 } ; double r2[3] = { -0.333333333333, -0.471404520791, 0.816496580928 };
double r3[3] = { -0.333333333333, -0.471404520791, -0.816496580928 } ; double r3[3] = { -0.333333333333, -0.471404520791, -0.816496580928 };
glBegin( GL_TRIANGLES ) ; glBegin( GL_TRIANGLES );
glNormal3d ( -1.0, 0.0, 0.0 ) ; glVertex3dv ( r1 ) ; glVertex3dv ( r3 ) ; glVertex3dv ( r2 ) ; glNormal3d ( -1.0, 0.0, 0.0 ); glVertex3dv ( r1 ); glVertex3dv ( r3 ); glVertex3dv ( r2 );
glNormal3d ( 0.333333333333, -0.942809041582, 0.0 ) ; glVertex3dv ( r0 ) ; glVertex3dv ( r2 ) ; glVertex3dv ( r3 ) ; glNormal3d ( 0.333333333333, -0.942809041582, 0.0 ); glVertex3dv ( r0 ); glVertex3dv ( r2 ); glVertex3dv ( r3 );
glNormal3d ( 0.333333333333, 0.471404520791, -0.816496580928 ) ; glVertex3dv ( r0 ) ; glVertex3dv ( r3 ) ; glVertex3dv ( r1 ) ; glNormal3d ( 0.333333333333, 0.471404520791, -0.816496580928 ); glVertex3dv ( r0 ); glVertex3dv ( r3 ); glVertex3dv ( r1 );
glNormal3d ( 0.333333333333, 0.471404520791, 0.816496580928 ) ; glVertex3dv ( r0 ) ; glVertex3dv ( r1 ) ; glVertex3dv ( r2 ) ; glNormal3d ( 0.333333333333, 0.471404520791, 0.816496580928 ); glVertex3dv ( r0 ); glVertex3dv ( r1 ); glVertex3dv ( r2 );
glEnd() ; glEnd();
} }
/* /*
@ -834,27 +834,27 @@ void FGAPIENTRY glutSolidTetrahedron( void )
double icos_r[12][3] = { { 1.0, 0.0, 0.0 }, double icos_r[12][3] = { { 1.0, 0.0, 0.0 },
{ 0.447213595500, 0.894427191000, 0.0 }, { 0.447213595500, 0.276393202252, 0.850650808354 }, { 0.447213595500, -0.723606797748, 0.525731112119 }, { 0.447213595500, -0.723606797748, -0.525731112119 }, { 0.447213595500, 0.276393202252, -0.850650808354 }, { 0.447213595500, 0.894427191000, 0.0 }, { 0.447213595500, 0.276393202252, 0.850650808354 }, { 0.447213595500, -0.723606797748, 0.525731112119 }, { 0.447213595500, -0.723606797748, -0.525731112119 }, { 0.447213595500, 0.276393202252, -0.850650808354 },
{ -0.447213595500, -0.894427191000, 0.0 }, { -0.447213595500, -0.276393202252, 0.850650808354 }, { -0.447213595500, 0.723606797748, 0.525731112119 }, { -0.447213595500, 0.723606797748, -0.525731112119 }, { -0.447213595500, -0.276393202252, -0.850650808354 }, { -0.447213595500, -0.894427191000, 0.0 }, { -0.447213595500, -0.276393202252, 0.850650808354 }, { -0.447213595500, 0.723606797748, 0.525731112119 }, { -0.447213595500, 0.723606797748, -0.525731112119 }, { -0.447213595500, -0.276393202252, -0.850650808354 },
{ -1.0, 0.0, 0.0 } } ; { -1.0, 0.0, 0.0 } };
int icos_v [20][3] = { { 0, 1, 2 }, { 0, 2, 3 }, { 0, 3, 4 }, { 0, 4, 5 }, { 0, 5, 1 }, int icos_v [20][3] = { { 0, 1, 2 }, { 0, 2, 3 }, { 0, 3, 4 }, { 0, 4, 5 }, { 0, 5, 1 },
{ 1, 8, 2 }, { 2, 7, 3 }, { 3, 6, 4 }, { 4, 10, 5 }, { 5, 9, 1 }, { 1, 8, 2 }, { 2, 7, 3 }, { 3, 6, 4 }, { 4, 10, 5 }, { 5, 9, 1 },
{ 1, 9, 8 }, { 2, 8, 7 }, { 3, 7, 6 }, { 4, 6, 10 }, { 5, 10, 9 }, { 1, 9, 8 }, { 2, 8, 7 }, { 3, 7, 6 }, { 4, 6, 10 }, { 5, 10, 9 },
{ 11, 9, 10 }, { 11, 8, 9 }, { 11, 7, 8 }, { 11, 6, 7 }, { 11, 10, 6 } } ; { 11, 9, 10 }, { 11, 8, 9 }, { 11, 7, 8 }, { 11, 6, 7 }, { 11, 10, 6 } };
void FGAPIENTRY glutWireIcosahedron( void ) void FGAPIENTRY glutWireIcosahedron( void )
{ {
int i ; int i ;
for ( i = 0; i < 20; i++ ) for ( i = 0; i < 20; i++ )
{ {
double normal[3] ; double normal[3];
normal[0] = ( icos_r[icos_v[i][1]][1] - icos_r[icos_v[i][0]][1] ) * ( icos_r[icos_v[i][2]][2] - icos_r[icos_v[i][0]][2] ) - ( icos_r[icos_v[i][1]][2] - icos_r[icos_v[i][0]][2] ) * ( icos_r[icos_v[i][2]][1] - icos_r[icos_v[i][0]][1] ) ; normal[0] = ( icos_r[icos_v[i][1]][1] - icos_r[icos_v[i][0]][1] ) * ( icos_r[icos_v[i][2]][2] - icos_r[icos_v[i][0]][2] ) - ( icos_r[icos_v[i][1]][2] - icos_r[icos_v[i][0]][2] ) * ( icos_r[icos_v[i][2]][1] - icos_r[icos_v[i][0]][1] );
normal[1] = ( icos_r[icos_v[i][1]][2] - icos_r[icos_v[i][0]][2] ) * ( icos_r[icos_v[i][2]][0] - icos_r[icos_v[i][0]][0] ) - ( icos_r[icos_v[i][1]][0] - icos_r[icos_v[i][0]][0] ) * ( icos_r[icos_v[i][2]][2] - icos_r[icos_v[i][0]][2] ) ; normal[1] = ( icos_r[icos_v[i][1]][2] - icos_r[icos_v[i][0]][2] ) * ( icos_r[icos_v[i][2]][0] - icos_r[icos_v[i][0]][0] ) - ( icos_r[icos_v[i][1]][0] - icos_r[icos_v[i][0]][0] ) * ( icos_r[icos_v[i][2]][2] - icos_r[icos_v[i][0]][2] );
normal[2] = ( icos_r[icos_v[i][1]][0] - icos_r[icos_v[i][0]][0] ) * ( icos_r[icos_v[i][2]][1] - icos_r[icos_v[i][0]][1] ) - ( icos_r[icos_v[i][1]][1] - icos_r[icos_v[i][0]][1] ) * ( icos_r[icos_v[i][2]][0] - icos_r[icos_v[i][0]][0] ) ; normal[2] = ( icos_r[icos_v[i][1]][0] - icos_r[icos_v[i][0]][0] ) * ( icos_r[icos_v[i][2]][1] - icos_r[icos_v[i][0]][1] ) - ( icos_r[icos_v[i][1]][1] - icos_r[icos_v[i][0]][1] ) * ( icos_r[icos_v[i][2]][0] - icos_r[icos_v[i][0]][0] );
glBegin ( GL_LINE_LOOP ) ; glBegin ( GL_LINE_LOOP );
glNormal3dv ( normal ) ; glNormal3dv ( normal );
glVertex3dv ( icos_r[icos_v[i][0]] ) ; glVertex3dv ( icos_r[icos_v[i][0]] );
glVertex3dv ( icos_r[icos_v[i][1]] ) ; glVertex3dv ( icos_r[icos_v[i][1]] );
glVertex3dv ( icos_r[icos_v[i][2]] ) ; glVertex3dv ( icos_r[icos_v[i][2]] );
glEnd () ; glEnd ();
} }
} }
@ -865,20 +865,20 @@ void FGAPIENTRY glutSolidIcosahedron( void )
{ {
int i ; int i ;
glBegin ( GL_TRIANGLES ) ; glBegin ( GL_TRIANGLES );
for ( i = 0; i < 20; i++ ) for ( i = 0; i < 20; i++ )
{ {
double normal[3] ; double normal[3];
normal[0] = ( icos_r[icos_v[i][1]][1] - icos_r[icos_v[i][0]][1] ) * ( icos_r[icos_v[i][2]][2] - icos_r[icos_v[i][0]][2] ) - ( icos_r[icos_v[i][1]][2] - icos_r[icos_v[i][0]][2] ) * ( icos_r[icos_v[i][2]][1] - icos_r[icos_v[i][0]][1] ) ; normal[0] = ( icos_r[icos_v[i][1]][1] - icos_r[icos_v[i][0]][1] ) * ( icos_r[icos_v[i][2]][2] - icos_r[icos_v[i][0]][2] ) - ( icos_r[icos_v[i][1]][2] - icos_r[icos_v[i][0]][2] ) * ( icos_r[icos_v[i][2]][1] - icos_r[icos_v[i][0]][1] );
normal[1] = ( icos_r[icos_v[i][1]][2] - icos_r[icos_v[i][0]][2] ) * ( icos_r[icos_v[i][2]][0] - icos_r[icos_v[i][0]][0] ) - ( icos_r[icos_v[i][1]][0] - icos_r[icos_v[i][0]][0] ) * ( icos_r[icos_v[i][2]][2] - icos_r[icos_v[i][0]][2] ) ; normal[1] = ( icos_r[icos_v[i][1]][2] - icos_r[icos_v[i][0]][2] ) * ( icos_r[icos_v[i][2]][0] - icos_r[icos_v[i][0]][0] ) - ( icos_r[icos_v[i][1]][0] - icos_r[icos_v[i][0]][0] ) * ( icos_r[icos_v[i][2]][2] - icos_r[icos_v[i][0]][2] );
normal[2] = ( icos_r[icos_v[i][1]][0] - icos_r[icos_v[i][0]][0] ) * ( icos_r[icos_v[i][2]][1] - icos_r[icos_v[i][0]][1] ) - ( icos_r[icos_v[i][1]][1] - icos_r[icos_v[i][0]][1] ) * ( icos_r[icos_v[i][2]][0] - icos_r[icos_v[i][0]][0] ) ; normal[2] = ( icos_r[icos_v[i][1]][0] - icos_r[icos_v[i][0]][0] ) * ( icos_r[icos_v[i][2]][1] - icos_r[icos_v[i][0]][1] ) - ( icos_r[icos_v[i][1]][1] - icos_r[icos_v[i][0]][1] ) * ( icos_r[icos_v[i][2]][0] - icos_r[icos_v[i][0]][0] );
glNormal3dv ( normal ) ; glNormal3dv ( normal );
glVertex3dv ( icos_r[icos_v[i][0]] ) ; glVertex3dv ( icos_r[icos_v[i][0]] );
glVertex3dv ( icos_r[icos_v[i][1]] ) ; glVertex3dv ( icos_r[icos_v[i][1]] );
glVertex3dv ( icos_r[icos_v[i][2]] ) ; glVertex3dv ( icos_r[icos_v[i][2]] );
} }
glEnd () ; glEnd ();
} }
/* /*
@ -888,28 +888,28 @@ double rdod_r[14][3] = { { 0.0, 0.0, 1.0 },
{ 0.707106781187, 0.000000000000, 0.5 }, { 0.000000000000, 0.707106781187, 0.5 }, { -0.707106781187, 0.000000000000, 0.5 }, { 0.000000000000, -0.707106781187, 0.5 }, { 0.707106781187, 0.000000000000, 0.5 }, { 0.000000000000, 0.707106781187, 0.5 }, { -0.707106781187, 0.000000000000, 0.5 }, { 0.000000000000, -0.707106781187, 0.5 },
{ 0.707106781187, 0.707106781187, 0.0 }, { -0.707106781187, 0.707106781187, 0.0 }, { -0.707106781187, -0.707106781187, 0.0 }, { 0.707106781187, -0.707106781187, 0.0 }, { 0.707106781187, 0.707106781187, 0.0 }, { -0.707106781187, 0.707106781187, 0.0 }, { -0.707106781187, -0.707106781187, 0.0 }, { 0.707106781187, -0.707106781187, 0.0 },
{ 0.707106781187, 0.000000000000, -0.5 }, { 0.000000000000, 0.707106781187, -0.5 }, { -0.707106781187, 0.000000000000, -0.5 }, { 0.000000000000, -0.707106781187, -0.5 }, { 0.707106781187, 0.000000000000, -0.5 }, { 0.000000000000, 0.707106781187, -0.5 }, { -0.707106781187, 0.000000000000, -0.5 }, { 0.000000000000, -0.707106781187, -0.5 },
{ 0.0, 0.0, -1.0 } } ; { 0.0, 0.0, -1.0 } };
int rdod_v [12][4] = { { 0, 1, 5, 2 }, { 0, 2, 6, 3 }, { 0, 3, 7, 4 }, { 0, 4, 8, 1 }, int rdod_v [12][4] = { { 0, 1, 5, 2 }, { 0, 2, 6, 3 }, { 0, 3, 7, 4 }, { 0, 4, 8, 1 },
{ 5, 10, 6, 2 }, { 6, 11, 7, 3 }, { 7, 12, 8, 4 }, { 8, 9, 5, 1 }, { 5, 10, 6, 2 }, { 6, 11, 7, 3 }, { 7, 12, 8, 4 }, { 8, 9, 5, 1 },
{ 5, 9, 13, 10 }, { 6, 10, 13, 11 }, { 7, 11, 13, 12 }, { 8, 12, 13, 9 } } ; { 5, 9, 13, 10 }, { 6, 10, 13, 11 }, { 7, 11, 13, 12 }, { 8, 12, 13, 9 } };
double rdod_n[12][3] = { double rdod_n[12][3] = {
{ 0.353553390594, 0.353553390594, 0.5 }, { -0.353553390594, 0.353553390594, 0.5 }, { -0.353553390594, -0.353553390594, 0.5 }, { 0.353553390594, -0.353553390594, 0.5 }, { 0.353553390594, 0.353553390594, 0.5 }, { -0.353553390594, 0.353553390594, 0.5 }, { -0.353553390594, -0.353553390594, 0.5 }, { 0.353553390594, -0.353553390594, 0.5 },
{ 0.000000000000, 1.000000000000, 0.0 }, { -1.000000000000, 0.000000000000, 0.0 }, { 0.000000000000, -1.000000000000, 0.0 }, { 1.000000000000, 0.000000000000, 0.0 }, { 0.000000000000, 1.000000000000, 0.0 }, { -1.000000000000, 0.000000000000, 0.0 }, { 0.000000000000, -1.000000000000, 0.0 }, { 1.000000000000, 0.000000000000, 0.0 },
{ 0.353553390594, 0.353553390594, -0.5 }, { -0.353553390594, 0.353553390594, -0.5 }, { -0.353553390594, -0.353553390594, -0.5 }, { 0.353553390594, -0.353553390594, -0.5 } { 0.353553390594, 0.353553390594, -0.5 }, { -0.353553390594, 0.353553390594, -0.5 }, { -0.353553390594, -0.353553390594, -0.5 }, { 0.353553390594, -0.353553390594, -0.5 }
} ; };
void FGAPIENTRY glutWireRhombicDodecahedron( void ) void FGAPIENTRY glutWireRhombicDodecahedron( void )
{ {
int i ; int i ;
for ( i = 0; i < 12; i++ ) for ( i = 0; i < 12; i++ )
{ {
glBegin ( GL_LINE_LOOP ) ; glBegin ( GL_LINE_LOOP );
glNormal3dv ( rdod_n[i] ) ; glNormal3dv ( rdod_n[i] );
glVertex3dv ( rdod_r[rdod_v[i][0]] ) ; glVertex3dv ( rdod_r[rdod_v[i][0]] );
glVertex3dv ( rdod_r[rdod_v[i][1]] ) ; glVertex3dv ( rdod_r[rdod_v[i][1]] );
glVertex3dv ( rdod_r[rdod_v[i][2]] ) ; glVertex3dv ( rdod_r[rdod_v[i][2]] );
glVertex3dv ( rdod_r[rdod_v[i][3]] ) ; glVertex3dv ( rdod_r[rdod_v[i][3]] );
glEnd () ; glEnd ();
} }
} }
@ -920,17 +920,17 @@ void FGAPIENTRY glutSolidRhombicDodecahedron( void )
{ {
int i ; int i ;
glBegin ( GL_QUADS ) ; glBegin ( GL_QUADS );
for ( i = 0; i < 12; i++ ) for ( i = 0; i < 12; i++ )
{ {
glNormal3dv ( rdod_n[i] ) ; glNormal3dv ( rdod_n[i] );
glVertex3dv ( rdod_r[rdod_v[i][0]] ) ; glVertex3dv ( rdod_r[rdod_v[i][0]] );
glVertex3dv ( rdod_r[rdod_v[i][1]] ) ; glVertex3dv ( rdod_r[rdod_v[i][1]] );
glVertex3dv ( rdod_r[rdod_v[i][2]] ) ; glVertex3dv ( rdod_r[rdod_v[i][2]] );
glVertex3dv ( rdod_r[rdod_v[i][3]] ) ; glVertex3dv ( rdod_r[rdod_v[i][3]] );
} }
glEnd () ; glEnd ();
} }
#define NUM_FACES 4 #define NUM_FACES 4
@ -941,12 +941,12 @@ static GLdouble tetrahedron_v[4][3] = /* Vertices */
{ 0.5, -0.288675134595, -0.144337567297 }, { 0.5, -0.288675134595, -0.144337567297 },
{ 0.0, 0.577350269189, -0.144337567297 }, { 0.0, 0.577350269189, -0.144337567297 },
{ 0.0, 0.0, 0.672159013631 } { 0.0, 0.0, 0.672159013631 }
} ; };
static GLint tetrahedron_i[4][3] = /* Vertex indices */ static GLint tetrahedron_i[4][3] = /* Vertex indices */
{ {
{ 0, 1, 2 }, { 0, 2, 3 }, { 0, 3, 1 }, { 1, 3, 2 } { 0, 1, 2 }, { 0, 2, 3 }, { 0, 3, 1 }, { 1, 3, 2 }
} ; };
static GLdouble tetrahedron_n[4][3] = /* Normals */ static GLdouble tetrahedron_n[4][3] = /* Normals */
{ {
@ -954,7 +954,7 @@ static GLdouble tetrahedron_n[4][3] = /* Normals */
{ -0.816496580928, 0.471404520791, 0.333333333333 }, { -0.816496580928, 0.471404520791, 0.333333333333 },
{ 0.0, -0.942809041582, 0.333333333333 }, { 0.0, -0.942809041582, 0.333333333333 },
{ 0.816496580928, 0.471404520791, 0.333333333333 } { 0.816496580928, 0.471404520791, 0.333333333333 }
} ; };
void FGAPIENTRY glutWireSierpinskiSponge ( int num_levels, GLdouble offset[3], GLdouble scale ) void FGAPIENTRY glutWireSierpinskiSponge ( int num_levels, GLdouble offset[3], GLdouble scale )
{ {
@ -965,36 +965,36 @@ void FGAPIENTRY glutWireSierpinskiSponge ( int num_levels, GLdouble offset[3], G
for ( i = 0 ; i < NUM_FACES ; i++ ) for ( i = 0 ; i < NUM_FACES ; i++ )
{ {
glBegin ( GL_LINE_LOOP ) ; glBegin ( GL_LINE_LOOP );
glNormal3dv ( tetrahedron_n[i] ) ; glNormal3dv ( tetrahedron_n[i] );
for ( j = 0; j < 3; j++ ) for ( j = 0; j < 3; j++ )
{ {
double x = offset[0] + scale * tetrahedron_v[tetrahedron_i[i][j]][0] ; double x = offset[0] + scale * tetrahedron_v[tetrahedron_i[i][j]][0];
double y = offset[1] + scale * tetrahedron_v[tetrahedron_i[i][j]][1] ; double y = offset[1] + scale * tetrahedron_v[tetrahedron_i[i][j]][1];
double z = offset[2] + scale * tetrahedron_v[tetrahedron_i[i][j]][2] ; double z = offset[2] + scale * tetrahedron_v[tetrahedron_i[i][j]][2];
glVertex3d ( x, y, z ) ; glVertex3d ( x, y, z );
} }
glEnd () ; glEnd ();
} }
} }
else else
{ {
GLdouble local_offset[3] ; /* Use a local variable to avoid buildup of roundoff errors */ GLdouble local_offset[3]; /* Use a local variable to avoid buildup of roundoff errors */
num_levels -- ; num_levels --;
scale /= 2.0 ; scale /= 2.0 ;
local_offset[0] = offset[0] + scale * tetrahedron_v[0][0] ; local_offset[0] = offset[0] + scale * tetrahedron_v[0][0];
local_offset[1] = offset[1] + scale * tetrahedron_v[0][1] ; local_offset[1] = offset[1] + scale * tetrahedron_v[0][1];
local_offset[2] = offset[2] + scale * tetrahedron_v[0][2] ; local_offset[2] = offset[2] + scale * tetrahedron_v[0][2];
glutWireSierpinskiSponge ( num_levels, local_offset, scale ) ; glutWireSierpinskiSponge ( num_levels, local_offset, scale );
local_offset[0] += scale ; local_offset[0] += scale;
glutWireSierpinskiSponge ( num_levels, local_offset, scale ) ; glutWireSierpinskiSponge ( num_levels, local_offset, scale );
local_offset[0] -= 0.5 * scale ; local_offset[0] -= 0.5 * scale;
local_offset[1] += 0.866025403784 * scale ; local_offset[1] += 0.866025403784 * scale;
glutWireSierpinskiSponge ( num_levels, local_offset, scale ) ; glutWireSierpinskiSponge ( num_levels, local_offset, scale );
local_offset[1] -= 0.577350269189 * scale ; local_offset[1] -= 0.577350269189 * scale;
local_offset[2] += 0.816496580928 * scale ; local_offset[2] += 0.816496580928 * scale;
glutWireSierpinskiSponge ( num_levels, local_offset, scale ) ; glutWireSierpinskiSponge ( num_levels, local_offset, scale );
} }
} }
@ -1004,39 +1004,39 @@ void FGAPIENTRY glutSolidSierpinskiSponge ( int num_levels, GLdouble offset[3],
if ( num_levels == 0 ) if ( num_levels == 0 )
{ {
glBegin ( GL_TRIANGLES ) ; glBegin ( GL_TRIANGLES );
for ( i = 0 ; i < NUM_FACES ; i++ ) for ( i = 0 ; i < NUM_FACES ; i++ )
{ {
glNormal3dv ( tetrahedron_n[i] ) ; glNormal3dv ( tetrahedron_n[i] );
for ( j = 0; j < 3; j++ ) for ( j = 0; j < 3; j++ )
{ {
double x = offset[0] + scale * tetrahedron_v[tetrahedron_i[i][j]][0] ; double x = offset[0] + scale * tetrahedron_v[tetrahedron_i[i][j]][0];
double y = offset[1] + scale * tetrahedron_v[tetrahedron_i[i][j]][1] ; double y = offset[1] + scale * tetrahedron_v[tetrahedron_i[i][j]][1];
double z = offset[2] + scale * tetrahedron_v[tetrahedron_i[i][j]][2] ; double z = offset[2] + scale * tetrahedron_v[tetrahedron_i[i][j]][2];
glVertex3d ( x, y, z ) ; glVertex3d ( x, y, z );
} }
} }
glEnd () ; glEnd ();
} }
else else
{ {
GLdouble local_offset[3] ; /* Use a local variable to avoid buildup of roundoff errors */ GLdouble local_offset[3]; /* Use a local variable to avoid buildup of roundoff errors */
num_levels -- ; num_levels --;
scale /= 2.0 ; scale /= 2.0 ;
local_offset[0] = offset[0] + scale * tetrahedron_v[0][0] ; local_offset[0] = offset[0] + scale * tetrahedron_v[0][0];
local_offset[1] = offset[1] + scale * tetrahedron_v[0][1] ; local_offset[1] = offset[1] + scale * tetrahedron_v[0][1];
local_offset[2] = offset[2] + scale * tetrahedron_v[0][2] ; local_offset[2] = offset[2] + scale * tetrahedron_v[0][2];
glutSolidSierpinskiSponge ( num_levels, local_offset, scale ) ; glutSolidSierpinskiSponge ( num_levels, local_offset, scale );
local_offset[0] += scale ; local_offset[0] += scale;
glutSolidSierpinskiSponge ( num_levels, local_offset, scale ) ; glutSolidSierpinskiSponge ( num_levels, local_offset, scale );
local_offset[0] -= 0.5 * scale ; local_offset[0] -= 0.5 * scale;
local_offset[1] += 0.866025403784 * scale ; local_offset[1] += 0.866025403784 * scale;
glutSolidSierpinskiSponge ( num_levels, local_offset, scale ) ; glutSolidSierpinskiSponge ( num_levels, local_offset, scale );
local_offset[1] -= 0.577350269189 * scale ; local_offset[1] -= 0.577350269189 * scale;
local_offset[2] += 0.816496580928 * scale ; local_offset[2] += 0.816496580928 * scale;
glutSolidSierpinskiSponge ( num_levels, local_offset, scale ) ; glutSolidSierpinskiSponge ( num_levels, local_offset, scale );
} }
} }

View File

@ -51,7 +51,7 @@ struct freeglutStrokeFont
void *ch ; void *ch ;
float top ; float top ;
float bottom ; float bottom ;
} ; };
struct freeglutBitmapFont struct freeglutBitmapFont
{ {
@ -59,7 +59,7 @@ struct freeglutBitmapFont
const int num_chars ; const int num_chars ;
const int first ; const int first ;
const void *ch ; const void *ch ;
} ; };
struct freeglutStrokeFont glutStrokeRoman ; struct freeglutStrokeFont glutStrokeRoman ;

View File

@ -230,7 +230,7 @@ void fgDeinitialize( void )
fgDestroyStructure( ); fgDestroyStructure( );
while( (timer = ( SFG_Timer * )fgState.Timers.First) ) while( timer = ( SFG_Timer * )fgState.Timers.First )
{ {
fgListRemove ( &fgState.Timers, &timer->Node ); fgListRemove ( &fgState.Timers, &timer->Node );
free( timer ); free( timer );
@ -376,9 +376,9 @@ ReadInteger(char *string, char **NextString)
} }
*NextString = string; *NextString = string;
if (Sign >= 0) if (Sign >= 0)
return (Result); return Result;
else else
return (-Result); return -Result;
} }
static int XParseGeometry ( static int XParseGeometry (
@ -394,7 +394,8 @@ static int XParseGeometry (
int tempX = 0, tempY = 0; int tempX = 0, tempY = 0;
char *nextCharacter; char *nextCharacter;
if ( (string == NULL) || (*string == '\0')) return(mask); if ( (string == NULL) || (*string == '\0'))
return mask;
if (*string == '=') if (*string == '=')
string++; /* ignore possible '=' at beg of geometry spec */ string++; /* ignore possible '=' at beg of geometry spec */
@ -402,7 +403,7 @@ static int XParseGeometry (
if (*strind != '+' && *strind != '-' && *strind != 'x') { if (*strind != '+' && *strind != '-' && *strind != 'x') {
tempWidth = ReadInteger(strind, &nextCharacter); tempWidth = ReadInteger(strind, &nextCharacter);
if (strind == nextCharacter) if (strind == nextCharacter)
return (0); return 0;
strind = nextCharacter; strind = nextCharacter;
mask |= WidthValue; mask |= WidthValue;
} }
@ -411,7 +412,7 @@ static int XParseGeometry (
strind++; strind++;
tempHeight = ReadInteger(strind, &nextCharacter); tempHeight = ReadInteger(strind, &nextCharacter);
if (strind == nextCharacter) if (strind == nextCharacter)
return (0); return 0;
strind = nextCharacter; strind = nextCharacter;
mask |= HeightValue; mask |= HeightValue;
} }
@ -421,7 +422,7 @@ static int XParseGeometry (
strind++; strind++;
tempX = -ReadInteger(strind, &nextCharacter); tempX = -ReadInteger(strind, &nextCharacter);
if (strind == nextCharacter) if (strind == nextCharacter)
return (0); return 0;
strind = nextCharacter; strind = nextCharacter;
mask |= XNegative; mask |= XNegative;
} }
@ -430,7 +431,7 @@ static int XParseGeometry (
strind++; strind++;
tempX = ReadInteger(strind, &nextCharacter); tempX = ReadInteger(strind, &nextCharacter);
if (strind == nextCharacter) if (strind == nextCharacter)
return(0); return 0;
strind = nextCharacter; strind = nextCharacter;
} }
mask |= XValue; mask |= XValue;
@ -439,7 +440,7 @@ static int XParseGeometry (
strind++; strind++;
tempY = -ReadInteger(strind, &nextCharacter); tempY = -ReadInteger(strind, &nextCharacter);
if (strind == nextCharacter) if (strind == nextCharacter)
return(0); return 0;
strind = nextCharacter; strind = nextCharacter;
mask |= YNegative; mask |= YNegative;
} }
@ -448,7 +449,7 @@ static int XParseGeometry (
strind++; strind++;
tempY = ReadInteger(strind, &nextCharacter); tempY = ReadInteger(strind, &nextCharacter);
if (strind == nextCharacter) if (strind == nextCharacter)
return(0); return 0;
strind = nextCharacter; strind = nextCharacter;
} }
mask |= YValue; mask |= YValue;
@ -458,7 +459,7 @@ static int XParseGeometry (
/* If strind isn't at the end of the string the it's an invalid /* If strind isn't at the end of the string the it's an invalid
geometry specification. */ geometry specification. */
if (*strind != '\0') return (0); if (*strind != '\0') return 0;
if (mask & XValue) if (mask & XValue)
*x = tempX; *x = tempX;
@ -468,7 +469,7 @@ static int XParseGeometry (
*width = tempWidth; *width = tempWidth;
if (mask & HeightValue) if (mask & HeightValue)
*height = tempHeight; *height = tempHeight;
return (mask); return mask;
} }
#endif #endif
@ -699,12 +700,12 @@ void FGAPIENTRY glutInitDisplayString( const char* displayMode )
* delimited by blanks or tabs. * delimited by blanks or tabs.
*/ */
char *token ; char *token ;
int len = strlen ( displayMode ) ; int len = strlen ( displayMode );
char *buffer = (char *)malloc ( (len+1) * sizeof(char) ) ; char *buffer = (char *)malloc ( (len+1) * sizeof(char) );
memcpy ( buffer, displayMode, len ) ; memcpy ( buffer, displayMode, len );
buffer[len] = '\0' ; buffer[len] = '\0';
token = strtok ( buffer, " \t" ) ; token = strtok ( buffer, " \t" );
while ( token ) while ( token )
{ {
/* /*
@ -856,14 +857,14 @@ void FGAPIENTRY glutInitDisplayString( const char* displayMode )
case 28 : /* Unrecognized */ case 28 : /* Unrecognized */
printf ( "WARNING - Display string token not recognized: %s\n", printf ( "WARNING - Display string token not recognized: %s\n",
token ) ; token );
break ; break ;
} }
token = strtok ( NULL, " \t" ) ; token = strtok ( NULL, " \t" );
} }
free ( buffer ) ; free ( buffer );
/* /*
* We will make use of this value when creating a new OpenGL context... * We will make use of this value when creating a new OpenGL context...

View File

@ -705,13 +705,13 @@ GLboolean fgSetupPixelFormat( SFG_Window* window, GLboolean checkOnly,
SFG_Window* fgCreateWindow( SFG_Window* parent, const char* title, SFG_Window* fgCreateWindow( SFG_Window* parent, const char* title,
int x, int y, int w, int h, int x, int y, int w, int h,
GLboolean gameMode, GLboolean isMenu ); GLboolean gameMode, GLboolean isMenu );
void fgSetWindow ( SFG_Window *window ) ; void fgSetWindow ( SFG_Window *window );
void fgOpenWindow( SFG_Window* window, const char* title, void fgOpenWindow( SFG_Window* window, const char* title,
int x, int y, int w, int h, GLboolean gameMode, int x, int y, int w, int h, GLboolean gameMode,
GLboolean isSubWindow ); GLboolean isSubWindow );
void fgCloseWindow( SFG_Window* window ); void fgCloseWindow( SFG_Window* window );
void fgAddToWindowDestroyList ( SFG_Window* window, void fgAddToWindowDestroyList ( SFG_Window* window,
GLboolean needToClose ) ; GLboolean needToClose );
void fgCloseWindows (); void fgCloseWindows ();
void fgDestroyWindow( SFG_Window* window, GLboolean needToClose ); void fgDestroyWindow( SFG_Window* window, GLboolean needToClose );
void fgClearCallBacks( SFG_Window *window ); void fgClearCallBacks( SFG_Window *window );

View File

@ -387,7 +387,7 @@ long fgElapsedTime( void )
#if TARGET_HOST_UNIX_X11 #if TARGET_HOST_UNIX_X11
gettimeofday( &fgState.Time.Value, NULL ); gettimeofday( &fgState.Time.Value, NULL );
#elif TARGET_HOST_WIN32 #elif TARGET_HOST_WIN32
fgState.Time.Value = timeGetTime () ; fgState.Time.Value = timeGetTime ();
#endif #endif
fgState.Time.Set = GL_TRUE ; fgState.Time.Set = GL_TRUE ;
@ -413,7 +413,7 @@ void fgError( const char *fmt, ... )
va_end( ap ); va_end( ap );
if ( fgState.Initialised ) if ( fgState.Initialised )
fgDeinitialize () ; fgDeinitialize ();
exit( 1 ); exit( 1 );
} }
@ -605,7 +605,7 @@ void FGAPIENTRY glutMainLoopEvent( void )
{ {
GETWINDOW( xclient ); GETWINDOW( xclient );
fgCloseWindow ( window ) ; fgCloseWindow ( window );
fgAddToWindowDestroyList ( window, GL_FALSE ); fgAddToWindowDestroyList ( window, GL_FALSE );
} }
break; break;
@ -730,7 +730,7 @@ void FGAPIENTRY glutMainLoopEvent( void )
event.xmotion.y_root - window->ActiveMenu->Y; event.xmotion.y_root - window->ActiveMenu->Y;
} }
window->ActiveMenu->Window->State.Redisplay = GL_TRUE ; window->ActiveMenu->Window->State.Redisplay = GL_TRUE ;
fgSetWindow( window->ActiveMenu->ParentWindow ) ; fgSetWindow( window->ActiveMenu->ParentWindow );
break; break;
} }
@ -1119,7 +1119,7 @@ void FGAPIENTRY glutMainLoop( void )
fgDeinitialize( ); fgDeinitialize( );
if( execState == GLUT_ACTION_EXIT ) if( execState == GLUT_ACTION_EXIT )
exit( 0 ) ; exit( 0 );
} }
} }
@ -1158,7 +1158,7 @@ LRESULT CALLBACK fgWindowProc( HWND hWnd, UINT uMsg, WPARAM wParam,
LONG lRet = 1; LONG lRet = 1;
if ( ( window == NULL ) && ( uMsg != WM_CREATE ) ) if ( ( window == NULL ) && ( uMsg != WM_CREATE ) )
return DefWindowProc( hWnd, uMsg, wParam, lParam ) ; return DefWindowProc( hWnd, uMsg, wParam, lParam );
/* printf ( "Window %3d message <%04x> %12d %12d\n", window?window->ID:0, /* printf ( "Window %3d message <%04x> %12d %12d\n", window?window->ID:0,
uMsg, wParam, lParam ); */ uMsg, wParam, lParam ); */
@ -1183,7 +1183,7 @@ LRESULT CALLBACK fgWindowProc( HWND hWnd, UINT uMsg, WPARAM wParam,
if( fgStructure.MenuContext ) if( fgStructure.MenuContext )
wglMakeCurrent( window->Window.Device, wglMakeCurrent( window->Window.Device,
fgStructure.MenuContext->Context fgStructure.MenuContext->Context
) ; );
else else
{ {
fgStructure.MenuContext = fgStructure.MenuContext =
@ -1192,7 +1192,7 @@ LRESULT CALLBACK fgWindowProc( HWND hWnd, UINT uMsg, WPARAM wParam,
wglCreateContext( window->Window.Device ); wglCreateContext( window->Window.Device );
} }
/* window->Window.Context = wglGetCurrentContext () ; */ /* window->Window.Context = wglGetCurrentContext (); */
window->Window.Context = wglCreateContext( window->Window.Device ); window->Window.Context = wglCreateContext( window->Window.Device );
} }
else else
@ -1756,7 +1756,7 @@ LRESULT CALLBACK fgWindowProc( HWND hWnd, UINT uMsg, WPARAM wParam,
/* User has finished resizing the window, force a redraw */ /* User has finished resizing the window, force a redraw */
INVOKE_WCB( *window, Display, ( ) ); INVOKE_WCB( *window, Display, ( ) );
/*lRet = DefWindowProc( hWnd, uMsg, wParam, lParam ) ; */ /*lRet = DefWindowProc( hWnd, uMsg, wParam, lParam ); */
break; break;
/* /*

View File

@ -289,7 +289,7 @@ static void fghDisplayMenuBox( SFG_Menu* menu )
glVertex2i( menu->Width - border, border); glVertex2i( menu->Width - border, border);
glEnd( ); glEnd( );
glColor4fv( menu_pen_back ) ; glColor4fv( menu_pen_back );
glBegin( GL_QUADS ); glBegin( GL_QUADS );
glVertex2i( border, border); glVertex2i( border, border);
glVertex2i( menu->Width - border, border); glVertex2i( menu->Width - border, border);

View File

@ -51,7 +51,7 @@
int FGAPIENTRY glutExtensionSupported( const char* extension ) int FGAPIENTRY glutExtensionSupported( const char* extension )
{ {
const char *extensions, *start; const char *extensions, *start;
const int len = strlen( extension ) ; const int len = strlen( extension );
/* /*
* Make sure there is a current window, and thus a current context available * Make sure there is a current window, and thus a current context available

View File

@ -132,10 +132,10 @@ int FGAPIENTRY glutGet( GLenum eWhat )
switch (eWhat) switch (eWhat)
{ {
case GLUT_INIT_STATE: case GLUT_INIT_STATE:
return ( fgState.Initialised ) ; return fgState.Initialised;
case GLUT_ELAPSED_TIME: case GLUT_ELAPSED_TIME:
return( fgElapsedTime() ); return fgElapsedTime();
} }
freeglut_assert_ready; freeglut_assert_ready;
@ -148,15 +148,15 @@ int FGAPIENTRY glutGet( GLenum eWhat )
/* /*
* Following values are stored in fgState and fgDisplay global structures * Following values are stored in fgState and fgDisplay global structures
*/ */
case GLUT_SCREEN_WIDTH: return( fgDisplay.ScreenWidth ); case GLUT_SCREEN_WIDTH: return fgDisplay.ScreenWidth ;
case GLUT_SCREEN_HEIGHT: return( fgDisplay.ScreenHeight ); case GLUT_SCREEN_HEIGHT: return fgDisplay.ScreenHeight ;
case GLUT_SCREEN_WIDTH_MM: return( fgDisplay.ScreenWidthMM ); case GLUT_SCREEN_WIDTH_MM: return fgDisplay.ScreenWidthMM ;
case GLUT_SCREEN_HEIGHT_MM: return( fgDisplay.ScreenHeightMM ); case GLUT_SCREEN_HEIGHT_MM: return fgDisplay.ScreenHeightMM;
case GLUT_INIT_WINDOW_X: return( fgState.Position.X ); case GLUT_INIT_WINDOW_X: return fgState.Position.X ;
case GLUT_INIT_WINDOW_Y: return( fgState.Position.Y ); case GLUT_INIT_WINDOW_Y: return fgState.Position.Y ;
case GLUT_INIT_WINDOW_WIDTH: return( fgState.Size.X ); case GLUT_INIT_WINDOW_WIDTH: return fgState.Size.X ;
case GLUT_INIT_WINDOW_HEIGHT: return( fgState.Size.Y ); case GLUT_INIT_WINDOW_HEIGHT: return fgState.Size.Y ;
case GLUT_INIT_DISPLAY_MODE: return( fgState.DisplayMode ); case GLUT_INIT_DISPLAY_MODE: return fgState.DisplayMode ;
/* /*
* The window/context specific queries are handled mostly by * The window/context specific queries are handled mostly by
@ -166,14 +166,14 @@ int FGAPIENTRY glutGet( GLenum eWhat )
/* /*
* XXX Multisampling. Return what I know about multisampling. * XXX Multisampling. Return what I know about multisampling.
*/ */
return( 0 ); return 0;
#if TARGET_HOST_UNIX_X11 #if TARGET_HOST_UNIX_X11
/* /*
* The rest of GLX queries under X are general enough to use a macro to * The rest of GLX queries under X are general enough to use a macro to
* check them * check them
*/ */
# define GLX_QUERY(a,b) case a: return( fghGetConfig( b ) ); # define GLX_QUERY(a,b) case a: return fghGetConfig( b );
GLX_QUERY( GLUT_WINDOW_RGBA, GLX_RGBA ); GLX_QUERY( GLUT_WINDOW_RGBA, GLX_RGBA );
GLX_QUERY( GLUT_WINDOW_DOUBLEBUFFER, GLX_DOUBLEBUFFER ); GLX_QUERY( GLUT_WINDOW_DOUBLEBUFFER, GLX_DOUBLEBUFFER );
@ -202,9 +202,9 @@ int FGAPIENTRY glutGet( GLenum eWhat )
* We've got a RGBA visual, so there is no colormap at all. * We've got a RGBA visual, so there is no colormap at all.
* The other possibility is that we have no current window set. * The other possibility is that we have no current window set.
*/ */
return( 0 ); return 0;
} }
return( fgStructure.Window->Window.VisualInfo->visual->map_entries ); return fgStructure.Window->Window.VisualInfo->visual->map_entries;
/* /*
* Those calls are somewhat similiar, as they use XGetWindowAttributes() * Those calls are somewhat similiar, as they use XGetWindowAttributes()
@ -219,7 +219,7 @@ int FGAPIENTRY glutGet( GLenum eWhat )
Window w; Window w;
if( fgStructure.Window == NULL ) if( fgStructure.Window == NULL )
return( 0 ); return 0;
XTranslateCoordinates( XTranslateCoordinates(
fgDisplay.Display, fgDisplay.Display,
@ -234,7 +234,7 @@ int FGAPIENTRY glutGet( GLenum eWhat )
} }
if ( w == 0 ) if ( w == 0 )
return( 0 ); return 0;
XTranslateCoordinates( XTranslateCoordinates(
fgDisplay.Display, fgDisplay.Display,
fgStructure.Window->Window.Handle, fgStructure.Window->Window.Handle,
@ -253,7 +253,7 @@ int FGAPIENTRY glutGet( GLenum eWhat )
XWindowAttributes winAttributes; XWindowAttributes winAttributes;
if( fgStructure.Window == NULL ) if( fgStructure.Window == NULL )
return( 0 ); return 0;
XGetWindowAttributes( XGetWindowAttributes(
fgDisplay.Display, fgDisplay.Display,
fgStructure.Window->Window.Handle, fgStructure.Window->Window.Handle,
@ -277,9 +277,9 @@ int FGAPIENTRY glutGet( GLenum eWhat )
*/ */
case GLUT_WINDOW_FORMAT_ID: case GLUT_WINDOW_FORMAT_ID:
if( fgStructure.Window == NULL ) if( fgStructure.Window == NULL )
return( 0 ); return 0;
return( fgStructure.Window->Window.VisualInfo->visualid ); return fgStructure.Window->Window.VisualInfo->visualid;
#elif TARGET_HOST_WIN32 #elif TARGET_HOST_WIN32
@ -287,52 +287,52 @@ int FGAPIENTRY glutGet( GLenum eWhat )
* Handle the OpenGL inquiries * Handle the OpenGL inquiries
*/ */
case GLUT_WINDOW_RGBA: case GLUT_WINDOW_RGBA:
glGetBooleanv ( GL_RGBA_MODE, &boolValue ) ; glGetBooleanv ( GL_RGBA_MODE, &boolValue );
returnValue = boolValue ? 1 : 0 ; returnValue = boolValue ? 1 : 0;
return ( returnValue ) ; return returnValue;
case GLUT_WINDOW_DOUBLEBUFFER: case GLUT_WINDOW_DOUBLEBUFFER:
glGetBooleanv ( GL_DOUBLEBUFFER, &boolValue ) ; glGetBooleanv ( GL_DOUBLEBUFFER, &boolValue );
returnValue = boolValue ? 1 : 0 ; returnValue = boolValue ? 1 : 0;
return ( returnValue ) ; return returnValue;
case GLUT_WINDOW_STEREO: case GLUT_WINDOW_STEREO:
glGetBooleanv ( GL_STEREO, &boolValue ) ; glGetBooleanv ( GL_STEREO, &boolValue );
returnValue = boolValue ? 1 : 0 ; returnValue = boolValue ? 1 : 0;
return ( returnValue ) ; return returnValue;
case GLUT_WINDOW_RED_SIZE: case GLUT_WINDOW_RED_SIZE:
glGetIntegerv ( GL_RED_BITS, &returnValue ) ; glGetIntegerv ( GL_RED_BITS, &returnValue );
return ( returnValue ) ; return returnValue;
case GLUT_WINDOW_GREEN_SIZE: case GLUT_WINDOW_GREEN_SIZE:
glGetIntegerv ( GL_GREEN_BITS, &returnValue ) ; glGetIntegerv ( GL_GREEN_BITS, &returnValue );
return ( returnValue ) ; return returnValue;
case GLUT_WINDOW_BLUE_SIZE: case GLUT_WINDOW_BLUE_SIZE:
glGetIntegerv ( GL_BLUE_BITS, &returnValue ) ; glGetIntegerv ( GL_BLUE_BITS, &returnValue );
return ( returnValue ) ; return returnValue;
case GLUT_WINDOW_ALPHA_SIZE: case GLUT_WINDOW_ALPHA_SIZE:
glGetIntegerv ( GL_ALPHA_BITS, &returnValue ) ; glGetIntegerv ( GL_ALPHA_BITS, &returnValue );
return ( returnValue ) ; return returnValue;
case GLUT_WINDOW_ACCUM_RED_SIZE: case GLUT_WINDOW_ACCUM_RED_SIZE:
glGetIntegerv ( GL_ACCUM_RED_BITS, &returnValue ) ; glGetIntegerv ( GL_ACCUM_RED_BITS, &returnValue );
return ( returnValue ) ; return returnValue;
case GLUT_WINDOW_ACCUM_GREEN_SIZE: case GLUT_WINDOW_ACCUM_GREEN_SIZE:
glGetIntegerv ( GL_ACCUM_GREEN_BITS, &returnValue ) ; glGetIntegerv ( GL_ACCUM_GREEN_BITS, &returnValue );
return ( returnValue ) ; return returnValue;
case GLUT_WINDOW_ACCUM_BLUE_SIZE: case GLUT_WINDOW_ACCUM_BLUE_SIZE:
glGetIntegerv ( GL_ACCUM_BLUE_BITS, &returnValue ) ; glGetIntegerv ( GL_ACCUM_BLUE_BITS, &returnValue );
return ( returnValue ) ; return returnValue;
case GLUT_WINDOW_ACCUM_ALPHA_SIZE: case GLUT_WINDOW_ACCUM_ALPHA_SIZE:
glGetIntegerv ( GL_ACCUM_ALPHA_BITS, &returnValue ) ; glGetIntegerv ( GL_ACCUM_ALPHA_BITS, &returnValue );
return ( returnValue ) ; return returnValue;
case GLUT_WINDOW_DEPTH_SIZE: case GLUT_WINDOW_DEPTH_SIZE:
glGetIntegerv ( GL_DEPTH_BITS, &returnValue ) ; glGetIntegerv ( GL_DEPTH_BITS, &returnValue );
return ( returnValue ) ; return returnValue;
case GLUT_WINDOW_BUFFER_SIZE: case GLUT_WINDOW_BUFFER_SIZE:
returnValue = 1 ; /* ????? */ returnValue = 1 ; /* ????? */
return ( returnValue ) ; return returnValue;
case GLUT_WINDOW_STENCIL_SIZE: case GLUT_WINDOW_STENCIL_SIZE:
returnValue = 0 ; /* ????? */ returnValue = 0 ; /* ????? */
return ( returnValue ) ; return returnValue;
case GLUT_WINDOW_X: case GLUT_WINDOW_X:
case GLUT_WINDOW_Y: case GLUT_WINDOW_Y:
@ -387,28 +387,28 @@ int FGAPIENTRY glutGet( GLenum eWhat )
switch( eWhat ) switch( eWhat )
{ {
case GLUT_WINDOW_X: return( winRect.left ); case GLUT_WINDOW_X: return winRect.left ;
case GLUT_WINDOW_Y: return( winRect.top ); case GLUT_WINDOW_Y: return winRect.top ;
case GLUT_WINDOW_WIDTH: return( winRect.right - winRect.left ); case GLUT_WINDOW_WIDTH: return winRect.right - winRect.left;
case GLUT_WINDOW_HEIGHT: return( winRect.bottom - winRect.top ); case GLUT_WINDOW_HEIGHT: return winRect.bottom - winRect.top;
} }
} }
break; break;
case GLUT_WINDOW_BORDER_WIDTH : case GLUT_WINDOW_BORDER_WIDTH :
return ( GetSystemMetrics( SM_CXSIZEFRAME ) ) ; return GetSystemMetrics( SM_CXSIZEFRAME );
case GLUT_WINDOW_HEADER_HEIGHT : case GLUT_WINDOW_HEADER_HEIGHT :
return ( GetSystemMetrics( SM_CYCAPTION ) ) ; return GetSystemMetrics( SM_CYCAPTION );
case GLUT_DISPLAY_MODE_POSSIBLE: case GLUT_DISPLAY_MODE_POSSIBLE:
return( fgSetupPixelFormat( fgStructure.Window, GL_TRUE, return fgSetupPixelFormat( fgStructure.Window, GL_TRUE,
PFD_MAIN_PLANE ) ); PFD_MAIN_PLANE );
case GLUT_WINDOW_FORMAT_ID: case GLUT_WINDOW_FORMAT_ID:
if( fgStructure.Window != NULL ) if( fgStructure.Window != NULL )
return( GetPixelFormat( fgStructure.Window->Window.Device ) ); return GetPixelFormat( fgStructure.Window->Window.Device );
return( 0 ); return 0;
#endif #endif
@ -416,39 +416,40 @@ int FGAPIENTRY glutGet( GLenum eWhat )
* The window structure queries * The window structure queries
*/ */
case GLUT_WINDOW_PARENT: case GLUT_WINDOW_PARENT:
if( fgStructure.Window == NULL ) return( 0 ); if( fgStructure.Window == NULL ) return 0;
if( fgStructure.Window->Parent == NULL ) return( 0 ); if( fgStructure.Window->Parent == NULL ) return 0;
return( fgStructure.Window->Parent->ID ); return fgStructure.Window->Parent->ID;
case GLUT_WINDOW_NUM_CHILDREN: case GLUT_WINDOW_NUM_CHILDREN:
if( fgStructure.Window == NULL ) if( fgStructure.Window == NULL )
return( 0 ); return 0;
return( fgListLength( &fgStructure.Window->Children ) ); return fgListLength( &fgStructure.Window->Children );
case GLUT_WINDOW_CURSOR: case GLUT_WINDOW_CURSOR:
if( fgStructure.Window == NULL ) if( fgStructure.Window == NULL )
return( 0 ); return 0;
return( fgStructure.Window->State.Cursor ); return fgStructure.Window->State.Cursor;
case GLUT_MENU_NUM_ITEMS: case GLUT_MENU_NUM_ITEMS:
if( fgStructure.Menu == NULL ) if( fgStructure.Menu == NULL )
return( 0 ); return 0;
return( fgListLength( &fgStructure.Menu->Entries ) ); return fgListLength( &fgStructure.Menu->Entries );
case GLUT_ACTION_ON_WINDOW_CLOSE: case GLUT_ACTION_ON_WINDOW_CLOSE:
return fgState.ActionOnWindowClose ; return fgState.ActionOnWindowClose;
case GLUT_VERSION : case GLUT_VERSION :
return VERSION_MAJOR * 10000 + VERSION_MINOR * 100 + VERSION_PATCH ; return VERSION_MAJOR * 10000 + VERSION_MINOR * 100 + VERSION_PATCH;
case GLUT_RENDERING_CONTEXT: case GLUT_RENDERING_CONTEXT:
return ( fgState.UseCurrentContext ? GLUT_USE_CURRENT_CONTEXT : GLUT_CREATE_NEW_CONTEXT ) ; return fgState.UseCurrentContext ? GLUT_USE_CURRENT_CONTEXT
: GLUT_CREATE_NEW_CONTEXT;
default: default:
fgWarning( "glutGet(): missing enum handle %i\n", eWhat ); fgWarning( "glutGet(): missing enum handle %i\n", eWhat );
break; break;
} }
return( -1 ); return -1;
} }
/* /*
@ -473,12 +474,12 @@ int FGAPIENTRY glutDeviceGet( GLenum eWhat )
* XXX Though in actuality, we can probably assume BOTH a * XXX Though in actuality, we can probably assume BOTH a
* XXX mouse and keyboard for most/all of our users. * XXX mouse and keyboard for most/all of our users.
*/ */
return( TRUE ); return TRUE ;
#if TARGET_HOST_UNIX_X11 #if TARGET_HOST_UNIX_X11
case GLUT_HAS_MOUSE: case GLUT_HAS_MOUSE:
return( TRUE ); return TRUE ;
case GLUT_NUM_MOUSE_BUTTONS: case GLUT_NUM_MOUSE_BUTTONS:
/* /*
@ -500,7 +501,7 @@ int FGAPIENTRY glutDeviceGet( GLenum eWhat )
* XXX XFree86...) It is at least worth taking a look at * XXX XFree86...) It is at least worth taking a look at
* XXX this file. * XXX this file.
*/ */
return( 3 ); return 3 ;
#elif TARGET_HOST_WIN32 #elif TARGET_HOST_WIN32
@ -509,13 +510,13 @@ int FGAPIENTRY glutDeviceGet( GLenum eWhat )
* The Windows can be booted without a mouse. * The Windows can be booted without a mouse.
* It would be nice to have this reported. * It would be nice to have this reported.
*/ */
return( GetSystemMetrics( SM_MOUSEPRESENT ) ); return GetSystemMetrics( SM_MOUSEPRESENT );
case GLUT_NUM_MOUSE_BUTTONS: case GLUT_NUM_MOUSE_BUTTONS:
/* /*
* We are much more fortunate under Win32 about this... * We are much more fortunate under Win32 about this...
*/ */
return( GetSystemMetrics( SM_CMOUSEBUTTONS ) ); return GetSystemMetrics( SM_CMOUSEBUTTONS );
#endif #endif
@ -526,27 +527,27 @@ int FGAPIENTRY glutDeviceGet( GLenum eWhat )
/* /*
* XXX WARNING: THIS IS A BIG LIE! * XXX WARNING: THIS IS A BIG LIE!
*/ */
return( 0 ); return 0;
case GLUT_HAS_SPACEBALL: case GLUT_HAS_SPACEBALL:
case GLUT_HAS_DIAL_AND_BUTTON_BOX: case GLUT_HAS_DIAL_AND_BUTTON_BOX:
case GLUT_HAS_TABLET: case GLUT_HAS_TABLET:
return( FALSE ); return FALSE;
case GLUT_NUM_SPACEBALL_BUTTONS: case GLUT_NUM_SPACEBALL_BUTTONS:
case GLUT_NUM_BUTTON_BOX_BUTTONS: case GLUT_NUM_BUTTON_BOX_BUTTONS:
case GLUT_NUM_DIALS: case GLUT_NUM_DIALS:
case GLUT_NUM_TABLET_BUTTONS: case GLUT_NUM_TABLET_BUTTONS:
return( 0 ); return 0;
case GLUT_DEVICE_IGNORE_KEY_REPEAT: case GLUT_DEVICE_IGNORE_KEY_REPEAT:
return( fgState.IgnoreKeyRepeat ); return fgState.IgnoreKeyRepeat;
case GLUT_DEVICE_KEY_REPEAT: case GLUT_DEVICE_KEY_REPEAT:
/* /*
* XXX WARNING: THIS IS A BIG LIE! * XXX WARNING: THIS IS A BIG LIE!
*/ */
return( GLUT_KEY_REPEAT_DEFAULT ); return GLUT_KEY_REPEAT_DEFAULT;
default: default:
fgWarning( "glutDeviceGet(): missing enum handle %i\n", eWhat ); fgWarning( "glutDeviceGet(): missing enum handle %i\n", eWhat );
@ -556,7 +557,7 @@ int FGAPIENTRY glutDeviceGet( GLenum eWhat )
/* /*
* And now -- the failure. * And now -- the failure.
*/ */
return( -1 ); return -1;
} }
/* /*
@ -567,10 +568,10 @@ int FGAPIENTRY glutGetModifiers( void )
if( fgState.Modifiers == 0xffffffff ) if( fgState.Modifiers == 0xffffffff )
{ {
fgWarning( "glutGetModifiers() called outside an input callback" ); fgWarning( "glutGetModifiers() called outside an input callback" );
return( 0 ); return 0;
} }
return( fgState.Modifiers ); return fgState.Modifiers;
} }
/* /*
@ -592,13 +593,13 @@ int FGAPIENTRY glutLayerGet( GLenum eWhat )
#if TARGET_HOST_UNIX_X11 #if TARGET_HOST_UNIX_X11
case GLUT_OVERLAY_POSSIBLE: case GLUT_OVERLAY_POSSIBLE:
return( FALSE ); return FALSE;
case GLUT_LAYER_IN_USE: case GLUT_LAYER_IN_USE:
return( GLUT_NORMAL ); return GLUT_NORMAL;
case GLUT_HAS_OVERLAY: case GLUT_HAS_OVERLAY:
return( FALSE ); return FALSE;
case GLUT_TRANSPARENT_INDEX: case GLUT_TRANSPARENT_INDEX:
/* /*
@ -606,29 +607,29 @@ int FGAPIENTRY glutLayerGet( GLenum eWhat )
* *
* XXX HUH? * XXX HUH?
*/ */
return( 0 ); return 0;
case GLUT_NORMAL_DAMAGED: case GLUT_NORMAL_DAMAGED:
/* /*
* XXX Actually I do not know. Maybe. * XXX Actually I do not know. Maybe.
*/ */
return( FALSE ); return FALSE;
case GLUT_OVERLAY_DAMAGED: case GLUT_OVERLAY_DAMAGED:
return( -1 ); return -1;
#elif TARGET_HOST_WIN32 #elif TARGET_HOST_WIN32
case GLUT_OVERLAY_POSSIBLE: case GLUT_OVERLAY_POSSIBLE:
/* return( fgSetupPixelFormat( fgStructure.Window, GL_TRUE, /* return fgSetupPixelFormat( fgStructure.Window, GL_TRUE,
PFD_OVERLAY_PLANE ) ); */ PFD_OVERLAY_PLANE ); */
return FALSE ; return FALSE ;
case GLUT_LAYER_IN_USE: case GLUT_LAYER_IN_USE:
return( GLUT_NORMAL ); return GLUT_NORMAL;
case GLUT_HAS_OVERLAY: case GLUT_HAS_OVERLAY:
return( FALSE ); return FALSE;
case GLUT_TRANSPARENT_INDEX: case GLUT_TRANSPARENT_INDEX:
/* /*
@ -636,16 +637,16 @@ int FGAPIENTRY glutLayerGet( GLenum eWhat )
* *
* XXX HUH? * XXX HUH?
*/ */
return( 0 ); return 0;
case GLUT_NORMAL_DAMAGED: case GLUT_NORMAL_DAMAGED:
/* /*
* XXX Actually I do not know. Maybe. * XXX Actually I do not know. Maybe.
*/ */
return( FALSE ); return FALSE;
case GLUT_OVERLAY_DAMAGED: case GLUT_OVERLAY_DAMAGED:
return( -1 ); return -1;
#endif #endif
default: default:
@ -656,7 +657,7 @@ int FGAPIENTRY glutLayerGet( GLenum eWhat )
/* /*
* And fail. That's good. Programs do love failing. * And fail. That's good. Programs do love failing.
*/ */
return( -1 ); return -1;
} }
/*** END OF FILE ***/ /*** END OF FILE ***/

View File

@ -279,7 +279,7 @@ void fgDestroyWindow( SFG_Window* window, GLboolean needToClose )
assert( window ); assert( window );
freeglut_assert_ready; freeglut_assert_ready;
while( (subWindow = ( SFG_Window * )window->Children.First) ) while( subWindow = ( SFG_Window * )window->Children.First )
fgDestroyWindow( subWindow, needToClose ); fgDestroyWindow( subWindow, needToClose );
/* /*
@ -291,7 +291,7 @@ void fgDestroyWindow( SFG_Window* window, GLboolean needToClose )
{ {
SFG_Window *activeWindow = fgStructure.Window ; SFG_Window *activeWindow = fgStructure.Window ;
INVOKE_WCB( *window, Destroy, ( ) ); INVOKE_WCB( *window, Destroy, ( ) );
fgSetWindow ( activeWindow ) ; fgSetWindow ( activeWindow );
} }
if( window->Parent ) if( window->Parent )
@ -402,7 +402,7 @@ void fgDestroyMenu( SFG_Menu* menu )
* Now we are pretty sure the menu is not used anywhere * Now we are pretty sure the menu is not used anywhere
* and that we can remove all of its entries * and that we can remove all of its entries
*/ */
while( (entry = ( SFG_MenuEntry * )menu->Entries.First) ) while( entry = ( SFG_MenuEntry * )menu->Entries.First )
{ {
fgListRemove( &menu->Entries, &entry->Node ); fgListRemove( &menu->Entries, &entry->Node );
@ -457,10 +457,10 @@ void fgDestroyStructure( void )
/* /*
* Make sure all windows and menus have been deallocated * Make sure all windows and menus have been deallocated
*/ */
while( (menu = ( SFG_Menu * )fgStructure.Menus.First) ) while( menu = ( SFG_Menu * )fgStructure.Menus.First )
fgDestroyMenu( menu ); fgDestroyMenu( menu );
while( (window = ( SFG_Window * )fgStructure.Windows.First) ) while( window = ( SFG_Window * )fgStructure.Windows.First )
fgDestroyWindow( window, GL_TRUE ); fgDestroyWindow( window, GL_TRUE );
} }
@ -651,7 +651,7 @@ void fgListAppend(SFG_List *list, SFG_Node *node)
{ {
SFG_Node *ln; SFG_Node *ln;
if ( (ln = (SFG_Node *)list->Last) ) if ( ln = (SFG_Node *)list->Last )
{ {
ln->Next = node; ln->Next = node;
node->Prev = ln; node->Prev = ln;
@ -670,9 +670,9 @@ void fgListRemove(SFG_List *list, SFG_Node *node)
{ {
SFG_Node *ln; SFG_Node *ln;
if( (ln = (SFG_Node *)node->Next) ) if( ln = (SFG_Node *)node->Next )
ln->Prev = node->Prev; ln->Prev = node->Prev;
if( (ln = (SFG_Node *)node->Prev) ) if( ln = (SFG_Node *)node->Prev )
ln->Next = node->Next; ln->Next = node->Next;
if( (ln = (SFG_Node *)list->First) == node ) if( (ln = (SFG_Node *)list->First) == node )
list->First = node->Next; list->First = node->Next;

View File

@ -529,12 +529,12 @@ void fgOpenWindow( SFG_Window* window, const char* title,
#endif #endif
window->Window.DoubleBuffered = window->Window.DoubleBuffered =
( fgState.DisplayMode & GLUT_DOUBLE ) ? 1 : 0 ; ( fgState.DisplayMode & GLUT_DOUBLE ) ? 1 : 0;
if ( ! window->Window.DoubleBuffered ) if ( ! window->Window.DoubleBuffered )
{ {
glDrawBuffer ( GL_FRONT ) ; glDrawBuffer ( GL_FRONT );
glReadBuffer ( GL_FRONT ) ; glReadBuffer ( GL_FRONT );
} }
fgSetWindow( window ); fgSetWindow( window );
} }
@ -625,7 +625,7 @@ void FGAPIENTRY glutSetWindow( int ID )
return; return;
} }
fgSetWindow( window ) ; fgSetWindow( window );
} }
/* /*