Assorted updates from John Fay.

git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@94 7f0cb862-5218-0410-a997-914c9d46530a
This commit is contained in:
brianp 2003-06-23 15:22:20 +00:00
parent 70637945ef
commit 36c63b7b43
7 changed files with 322 additions and 322 deletions

View File

@ -1065,7 +1065,7 @@ is not implemented in <i>freeglut</i>. </p>
<p>
The following state variables may be queried with glutGet.
The following state variables may be queried with "<tt>glutGet</tt>".
The returned value is an integer.
</p>
@ -1134,7 +1134,7 @@ These queries do not depend on the current window.
<h2> 13.7&nbsp; glutGetProcAddress</h2>
<p><tt>glutGetProcAddress</tt> returns
a pointer to a named GL or freeglut function. </p>
a pointer to a named GL or <i>freeglut</i> function. </p>
<p><b>Usage</b></p>
<p><tt>void *glutGetProcAddress ( const
char *procName ) ;</tt></p>
@ -1150,8 +1150,11 @@ the application will avoid this hard dependency and be more portable and interop
better with various implementations of OpenGL. </p>
<p> Both OpenGL functions and freeglut
functions can be queried with this function. </p>
<p><b>NOTE</b>: this function is not supported
in GLUT. </p>
<p><b>Changes From GLUT</b> </p>
<p>GLUT does not include this function.
</p>
<h1> 14.0&nbsp;<a name="FontRendering"></a>
Font Rendering Functions</h1>
<i>Freeglut</i> supports two types of font rendering:&nbsp; bitmap fonts,
@ -1872,15 +1875,17 @@ GLUT State</h1>
<p>
freeglut users should normally just include GL/glut.h in their programs.
Programs which need freeglut-specific functions should also include
GL/freeglut_ext.h as follows:
Application programmers who are porting their GLUT programs to <i>freeglut</i> may continue
to include <tt>&lt;GL/glut.h&gt;</tt> in their programs.
Programs which use the <i>freeglut</i>-specific extensions to GLUT should include
<tt>&lt;GL/freeglut.h&gt;</tt>. One possible arrangement is as follows:
</p>
<pre>
#include &lt;GL/glut.h&gt;
#ifdef FREEGLUT
#include &lt;GL/freeglut_ext.h&gt;
#else
#include &lt;GL/glut.h&gt;
#endif
</pre>

View File

@ -100,7 +100,7 @@ void FGAPIENTRY glutSwapBuffers( void )
if (fgState.SwapTime == 0)
fgState.SwapTime = t;
else if (t - fgState.SwapTime > fgState.FPSInterval) {
float time = 0.001 * (t - fgState.SwapTime);
float time = 0.001f * (t - fgState.SwapTime);
float fps = (float) fgState.SwapCount / time;
fprintf(stderr, "freeglut: %d frames in %.2f seconds = %.2f FPS\n",
fgState.SwapCount, time, fps);

View File

@ -75,7 +75,7 @@ void fghRememberState( void )
#elif TARGET_HOST_WIN32
DEVMODE devMode;
/* DEVMODE devMode; */
/*
* Grab the current desktop settings...
@ -250,7 +250,7 @@ GLboolean fghChangeDisplayMode( GLboolean haveToTest )
unsigned int displayModes = 0, mode = 0xffffffff;
GLboolean success = FALSE;
HDC desktopDC;
/* HDC desktopDC; */
DEVMODE devMode;
/*
@ -278,10 +278,10 @@ GLboolean fghChangeDisplayMode( GLboolean haveToTest )
displayModes++;
}
if( mode == 0xffffffff )
if ( mode == 0xffffffff )
{
/* then try without Display Frequency */
displayModes=0;
displayModes = 0;
/*
* Enumerate the available display modes

View File

@ -71,10 +71,10 @@
*/
void FGAPIENTRY glutWireCube( GLdouble dSize )
{
float size = (float) dSize * 0.5f;
double size = dSize * 0.5;
# define V(a,b,c) glVertex3f( a size, b size, c size );
# define N(a,b,c) glNormal3f( a, b, c );
# define V(a,b,c) glVertex3d( a size, b size, c size );
# define N(a,b,c) glNormal3d( a, b, c );
/*
* PWO: I dared to convert the code to use macros...
@ -95,10 +95,10 @@ void FGAPIENTRY glutWireCube( GLdouble dSize )
*/
void FGAPIENTRY glutSolidCube( GLdouble dSize )
{
float size = (float) dSize * 0.5f;
double size = dSize * 0.5;
# define V(a,b,c) glVertex3f( a size, b size, c size );
# define N(a,b,c) glNormal3f( a, b, c );
# define V(a,b,c) glVertex3d( a size, b size, c size );
# define N(a,b,c) glNormal3d( a, b, c );
/*
* PWO: Again, I dared to convert the code to use macros...
@ -121,18 +121,18 @@ void FGAPIENTRY glutSolidCube( GLdouble dSize )
*/
void FGAPIENTRY glutWireSphere( GLdouble dRadius, GLint slices, GLint stacks )
{
float radius = (float) dRadius, phi, psi, dpsi, dphi;
float* vertex;
double radius = dRadius, phi, psi, dpsi, dphi;
double *vertex;
int i, j;
float cphi, sphi, cpsi, spsi ;
double cphi, sphi, cpsi, spsi ;
/*
* Allocate the vertices array
*/
vertex = calloc( sizeof(float), 3 * slices * (stacks - 1) );
vertex = calloc( sizeof(double), 3 * slices * (stacks - 1) );
glPushMatrix();
glScalef( radius, radius, radius );
glScaled( radius, radius, radius );
dpsi = M_PI / (stacks + 1);
dphi = 2 * M_PI / slices;
@ -140,15 +140,15 @@ void FGAPIENTRY glutWireSphere( GLdouble dRadius, GLint slices, GLint stacks )
for( j=0; j<stacks-1; j++ )
{
cpsi = (float)cos ( psi ) ;
spsi = (float)sin ( psi ) ;
phi = 0;
cpsi = cos ( psi ) ;
spsi = sin ( psi ) ;
phi = 0.0;
for( i=0; i<slices; i++ )
{
int offset = 3 * ( j * slices + i ) ;
cphi = (float)cos ( phi ) ;
sphi = (float)sin ( phi ) ;
cphi = cos ( phi ) ;
sphi = sin ( phi ) ;
*(vertex + offset + 0) = sphi * spsi ;
*(vertex + offset + 1) = cphi * spsi ;
*(vertex + offset + 2) = cpsi ;
@ -161,18 +161,18 @@ void FGAPIENTRY glutWireSphere( GLdouble dRadius, GLint slices, GLint stacks )
for( i=0; i<slices; i++ )
{
glBegin( GL_LINE_STRIP );
glNormal3f( 0, 0, 1 );
glVertex3f( 0, 0, 1 );
glNormal3d( 0, 0, 1 );
glVertex3d( 0, 0, 1 );
for( j=0; j<stacks - 1; j++ )
{
int offset = 3 * ( j * slices + i ) ;
glNormal3fv( vertex + offset );
glVertex3fv( vertex + offset );
glNormal3dv( vertex + offset );
glVertex3dv( vertex + offset );
}
glNormal3f(0, 0, -1);
glVertex3f(0, 0, -1);
glNormal3d(0, 0, -1);
glVertex3d(0, 0, -1);
glEnd();
}
@ -183,8 +183,8 @@ void FGAPIENTRY glutWireSphere( GLdouble dRadius, GLint slices, GLint stacks )
for( i=0; i<slices; i++ )
{
int offset = 3 * ( j * slices + i ) ;
glNormal3fv( vertex + offset );
glVertex3fv( vertex + offset );
glNormal3dv( vertex + offset );
glVertex3dv( vertex + offset );
}
glEnd();
@ -199,16 +199,16 @@ void FGAPIENTRY glutWireSphere( GLdouble dRadius, GLint slices, GLint stacks )
*/
void FGAPIENTRY glutSolidSphere( GLdouble dRadius, GLint slices, GLint stacks )
{
float radius = (float) dRadius, phi, psi, dpsi, dphi;
float *next, *tmp, *row;
double radius = dRadius, phi, psi, dpsi, dphi;
double *next, *tmp, *row;
int i, j;
float cphi, sphi, cpsi, spsi ;
double cphi, sphi, cpsi, spsi ;
glPushMatrix();
/* glScalef( radius, radius, radius ); */
row = calloc( sizeof(float), slices * 3 );
next = calloc( sizeof(float), slices * 3 );
row = calloc( sizeof(double), slices * 3 );
next = calloc( sizeof(double), slices * 3 );
dpsi = M_PI / (stacks + 1);
dphi = 2 * M_PI / slices;
@ -217,8 +217,8 @@ void FGAPIENTRY glutSolidSphere( GLdouble dRadius, GLint slices, GLint stacks )
/* init first line + do polar cap */
glBegin( GL_TRIANGLE_FAN );
glNormal3f( 0, 0, 1 );
glVertex3f( 0, 0, radius );
glNormal3d( 0.0, 0.0, 1.0 );
glVertex3d( 0.0, 0.0, radius );
for( i=0; i<slices; i++ )
{
@ -226,8 +226,8 @@ void FGAPIENTRY glutSolidSphere( GLdouble dRadius, GLint slices, GLint stacks )
row[ i * 3 + 1 ] = cos( phi ) * sin( psi );
row[ i * 3 + 2 ] = cos( psi );
glNormal3fv( row + 3 * i );
glVertex3f(
glNormal3dv( row + 3 * i );
glVertex3d(
radius * *(row + 3 * i + 0),
radius * *(row + 3 * i + 1),
radius * *(row + 3 * i + 2)
@ -236,16 +236,16 @@ void FGAPIENTRY glutSolidSphere( GLdouble dRadius, GLint slices, GLint stacks )
phi += dphi;
}
glNormal3fv( row );
glVertex3f( radius * *(row + 0), radius * *(row + 1), radius * *(row + 2) );
glNormal3dv( row );
glVertex3d( radius * *(row + 0), radius * *(row + 1), radius * *(row + 2) );
glEnd();
for( j=0; j<stacks-1; j++ )
{
phi = 0;
phi = 0.0;
psi += dpsi;
cpsi = (float)cos ( psi ) ;
spsi = (float)sin ( psi ) ;
cpsi = cos ( psi ) ;
spsi = sin ( psi ) ;
/* get coords */
glBegin( GL_QUAD_STRIP );
@ -253,21 +253,21 @@ void FGAPIENTRY glutSolidSphere( GLdouble dRadius, GLint slices, GLint stacks )
/* glBegin(GL_LINE_LOOP); */
for( i=0; i<slices; i++ )
{
cphi = (float)cos ( phi ) ;
sphi = (float)sin ( phi ) ;
cphi = cos ( phi ) ;
sphi = sin ( phi ) ;
next[ i * 3 + 0 ] = sphi * spsi ;
next[ i * 3 + 1 ] = cphi * spsi ;
next[ i * 3 + 2 ] = cpsi ;
glNormal3fv( row + i * 3 );
glVertex3f(
glNormal3dv( row + i * 3 );
glVertex3d(
radius * *(row + 3 * i + 0),
radius * *(row + 3 * i + 1),
radius * *(row + 3 * i + 2)
);
glNormal3fv( next + i * 3 );
glVertex3f(
glNormal3dv( next + i * 3 );
glVertex3d(
radius * *(next + 3 * i + 0),
radius * *(next + 3 * i + 1),
radius * *(next + 3 * i + 2)
@ -276,10 +276,10 @@ void FGAPIENTRY glutSolidSphere( GLdouble dRadius, GLint slices, GLint stacks )
phi += dphi;
}
glNormal3fv( row );
glVertex3f( radius * *(row + 0), radius * *(row + 1), radius * *(row + 2) );
glNormal3fv( next );
glVertex3f( radius * *(next + 0), radius * *(next + 1), radius * *(next + 2) );
glNormal3dv( row );
glVertex3d( radius * *(row + 0), radius * *(row + 1), radius * *(row + 2) );
glNormal3dv( next );
glVertex3d( radius * *(next + 0), radius * *(next + 1), radius * *(next + 2) );
glEnd();
tmp = row;
@ -289,15 +289,15 @@ void FGAPIENTRY glutSolidSphere( GLdouble dRadius, GLint slices, GLint stacks )
/* south pole */
glBegin( GL_TRIANGLE_FAN );
glNormal3f( 0, 0, -1 );
glVertex3f( 0, 0, -radius );
glNormal3fv( row );
glVertex3f( radius * *(row + 0), radius * *(row + 1), radius * *(row + 2) );
glNormal3d( 0.0, 0.0, -1.0 );
glVertex3d( 0.0, 0.0, -radius );
glNormal3dv( row );
glVertex3d( radius * *(row + 0), radius * *(row + 1), radius * *(row + 2) );
for( i=slices-1; i>=0; i-- )
{
glNormal3fv(row + 3 * i);
glVertex3f(
glNormal3dv(row + 3 * i);
glVertex3d(
radius * *(row + 3 * i + 0),
radius * *(row + 3 * i + 1),
radius * *(row + 3 * i + 2)
@ -316,20 +316,20 @@ void FGAPIENTRY glutSolidSphere( GLdouble dRadius, GLint slices, GLint stacks )
*/
void FGAPIENTRY glutWireCone( GLdouble base, GLdouble height, GLint slices, GLint stacks )
{
float alt = (float) height / (float) (stacks + 1);
float angle = (float) M_PI / (float) slices * 2.0f;
float slope = (float) ( height / base );
float sBase = (float)base ;
float sinNormal = (float)( base / sqrt ( height * height + base * base )) ;
float cosNormal = (float)( height / sqrt ( height * height + base * base )) ;
double alt = height / (double) (stacks + 1);
double angle = M_PI / (double) slices * 2.0;
double slope = ( height / base );
double sBase = base ;
double sinNormal = ( base / sqrt ( height * height + base * base )) ;
double cosNormal = ( height / sqrt ( height * height + base * base )) ;
float* vertices = NULL;
double *vertices = NULL;
int i, j;
/*
* We need 'slices' points on a circle
*/
vertices = calloc( sizeof(float), 2 * (slices + 1) );
vertices = calloc( sizeof(double), 2 * (slices + 1) );
for( j=0; j<slices+1; j++ )
{
@ -343,10 +343,10 @@ void FGAPIENTRY glutWireCone( GLdouble base, GLdouble height, GLint slices, GLin
for( j=0; j<slices; j++ )
{
glBegin( GL_LINE_LOOP );
glNormal3f( 0, 0, -1 );
glVertex3f( vertices[ (j+0)*2+0 ] * sBase, vertices[ (j+0)*2+1 ] * sBase, 0 );
glVertex3f( vertices[ (j+1)*2+0 ] * sBase, vertices[ (j+1)*2+1 ] * sBase, 0 );
glVertex3f( 0, 0, 0 );
glNormal3d( 0.0, 0.0, -1.0 );
glVertex3d( vertices[ (j+0)*2+0 ] * sBase, vertices[ (j+0)*2+1 ] * sBase, 0 );
glVertex3d( vertices[ (j+1)*2+0 ] * sBase, vertices[ (j+1)*2+1 ] * sBase, 0 );
glVertex3d( 0.0, 0.0, 0.0 );
glEnd();
}
@ -355,27 +355,27 @@ void FGAPIENTRY glutWireCone( GLdouble base, GLdouble height, GLint slices, GLin
*/
for( i=0; i<stacks; i++ )
{
float alt_a = i * alt, alt_b = (i + 1) * alt;
float scl_a = (height - alt_a) / slope;
float scl_b = (height - alt_b) / slope;
double alt_a = i * alt, alt_b = (i + 1) * alt;
double scl_a = (height - alt_a) / slope;
double scl_b = (height - alt_b) / slope;
for( j=0; j<slices; j++ )
{
glBegin( GL_LINE_LOOP );
glNormal3f( sinNormal * vertices[(j+0)*2+0], sinNormal * vertices[(j+0)*2+1], cosNormal ) ;
glVertex3f( vertices[(j+0)*2+0] * scl_a, vertices[(j+0)*2+1] * scl_a, alt_a );
glNormal3f( sinNormal * vertices[(j+1)*2+0], sinNormal * vertices[(j+1)*2+1], cosNormal ) ;
glVertex3f( vertices[(j+1)*2+0] * scl_a, vertices[(j+1)*2+1] * scl_a, alt_a );
glNormal3f( sinNormal * vertices[(j+0)*2+0], sinNormal * vertices[(j+0)*2+1], cosNormal ) ;
glVertex3f( vertices[(j+0)*2+0] * scl_b, vertices[(j+0)*2+1] * scl_b, alt_b );
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 );
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 );
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 );
glEnd();
glBegin( GL_LINE_LOOP );
glNormal3f( sinNormal * vertices[(j+0)*2+0], sinNormal * vertices[(j+0)*2+1], cosNormal ) ;
glVertex3f( vertices[(j+0)*2+0] * scl_b, vertices[(j+0)*2+1] * scl_b, alt_b );
glNormal3f( sinNormal * vertices[(j+1)*2+0], sinNormal * vertices[(j+1)*2+1], cosNormal ) ;
glVertex3f( vertices[(j+1)*2+0] * scl_b, vertices[(j+1)*2+1] * scl_b, alt_b );
glVertex3f( 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 ) ;
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 ) ;
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 );
glEnd();
}
}
@ -385,14 +385,14 @@ void FGAPIENTRY glutWireCone( GLdouble base, GLdouble height, GLint slices, GLin
*/
for( j=0; j<slices; j++ )
{
float scl = alt / slope;
double scl = alt / slope;
glBegin( GL_LINE_LOOP );
glNormal3f( sinNormal * vertices[(j+0)*2+0], sinNormal * vertices[(j+0)*2+1], cosNormal ) ;
glVertex3f( vertices[ (j+0)*2+0 ] * scl, vertices[ (j+0)*2+1 ] * scl, height - alt );
glNormal3f( sinNormal * vertices[(j+1)*2+0], sinNormal * vertices[(j+1)*2+1], cosNormal ) ;
glVertex3f( vertices[ (j+1)*2+0 ] * scl, vertices[ (j+1)*2+1 ] * scl, height - alt );
glVertex3f( 0, 0, height );
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 );
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( 0, 0, height );
glEnd();
}
}
@ -402,20 +402,20 @@ void FGAPIENTRY glutWireCone( GLdouble base, GLdouble height, GLint slices, GLin
*/
void FGAPIENTRY glutSolidCone( GLdouble base, GLdouble height, GLint slices, GLint stacks )
{
float alt = (float) height / (float) (stacks + 1);
float angle = (float) M_PI / (float) slices * 2.0f;
float slope = (float) ( height / base );
float sBase = (float)base ;
float sinNormal = (float)( base / sqrt ( height * height + base * base )) ;
float cosNormal = (float)( height / sqrt ( height * height + base * base )) ;
double alt = height / (double) (stacks + 1);
double angle = M_PI / (double) slices * 2.0f;
double slope = ( height / base );
double sBase = base ;
double sinNormal = ( base / sqrt ( height * height + base * base )) ;
double cosNormal = ( height / sqrt ( height * height + base * base )) ;
float* vertices = NULL;
double *vertices = NULL;
int i, j;
/*
* We need 'slices' points on a circle
*/
vertices = calloc( sizeof(float), 2 * (slices + 1) );
vertices = calloc( sizeof(double), 2 * (slices + 1) );
for( j=0; j<slices+1; j++ )
{
@ -428,13 +428,13 @@ void FGAPIENTRY glutSolidCone( GLdouble base, GLdouble height, GLint slices, GLi
*/
for( j=0; j<slices; j++ )
{
float scl = height / slope;
double scl = height / slope;
glBegin( GL_TRIANGLES );
glNormal3f( 0, 0, -1 );
glVertex3f( vertices[ (j+0)*2+0 ] * sBase, vertices[ (j+0)*2+1 ] * sBase, 0 );
glVertex3f( vertices[ (j+1)*2+0 ] * sBase, vertices[ (j+1)*2+1 ] * sBase, 0 );
glVertex3f( 0, 0, 0 );
glNormal3d( 0.0, 0.0, -1.0 );
glVertex3d( vertices[ (j+0)*2+0 ] * sBase, vertices[ (j+0)*2+1 ] * sBase, 0 );
glVertex3d( vertices[ (j+1)*2+0 ] * sBase, vertices[ (j+1)*2+1 ] * sBase, 0 );
glVertex3d( 0.0, 0.0, 0.0 );
glEnd();
}
@ -443,27 +443,27 @@ void FGAPIENTRY glutSolidCone( GLdouble base, GLdouble height, GLint slices, GLi
*/
for( i=0; i<stacks; i++ )
{
float alt_a = i * alt, alt_b = (i + 1) * alt;
float scl_a = (height - alt_a) / slope;
float scl_b = (height - alt_b) / slope;
double alt_a = i * alt, alt_b = (i + 1) * alt;
double scl_a = (height - alt_a) / slope;
double scl_b = (height - alt_b) / slope;
for( j=0; j<slices; j++ )
{
glBegin( GL_TRIANGLES );
glNormal3f( sinNormal * vertices[(j+0)*2+0], sinNormal * vertices[(j+0)*2+1], cosNormal ) ;
glVertex3f( vertices[(j+0)*2+0] * scl_a, vertices[(j+0)*2+1] * scl_a, alt_a );
glNormal3f( sinNormal * vertices[(j+1)*2+0], sinNormal * vertices[(j+1)*2+1], cosNormal ) ;
glVertex3f( vertices[(j+1)*2+0] * scl_a, vertices[(j+1)*2+1] * scl_a, alt_a );
glNormal3f( sinNormal * vertices[(j+0)*2+0], sinNormal * vertices[(j+0)*2+1], cosNormal ) ;
glVertex3f( vertices[(j+0)*2+0] * scl_b, vertices[(j+0)*2+1] * scl_b, alt_b );
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 );
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 );
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 );
glEnd();
glBegin( GL_TRIANGLES );
glNormal3f( sinNormal * vertices[(j+0)*2+0], sinNormal * vertices[(j+0)*2+1], cosNormal ) ;
glVertex3f( vertices[(j+0)*2+0] * scl_b, vertices[(j+0)*2+1] * scl_b, alt_b );
glNormal3f( sinNormal * vertices[(j+1)*2+0], sinNormal * vertices[(j+1)*2+1], cosNormal ) ;
glVertex3f( vertices[(j+1)*2+0] * scl_b, vertices[(j+1)*2+1] * scl_b, alt_b );
glVertex3f( 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 ) ;
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 ) ;
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 );
glEnd();
}
}
@ -473,14 +473,14 @@ void FGAPIENTRY glutSolidCone( GLdouble base, GLdouble height, GLint slices, GLi
*/
for( j=0; j<slices; j++ )
{
float scl = alt / slope;
double scl = alt / slope;
glBegin( GL_TRIANGLES );
glNormal3f( sinNormal * vertices[(j+0)*2+0], sinNormal * vertices[(j+0)*2+1], cosNormal ) ;
glVertex3f( vertices[ (j+0)*2+0 ] * scl, vertices[ (j+0)*2+1 ] * scl, height - alt );
glNormal3f( sinNormal * vertices[(j+1)*2+0], sinNormal * vertices[(j+1)*2+1], cosNormal ) ;
glVertex3f( vertices[ (j+1)*2+0 ] * scl, vertices[ (j+1)*2+1 ] * scl, height - alt );
glVertex3f( 0, 0, height );
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 );
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( 0, 0, height );
glEnd();
}
}
@ -490,34 +490,34 @@ void FGAPIENTRY glutSolidCone( GLdouble base, GLdouble height, GLint slices, GLi
*/
void FGAPIENTRY glutWireTorus( GLdouble dInnerRadius, GLdouble dOuterRadius, GLint nSides, GLint nRings )
{
float iradius = (float) dInnerRadius, oradius = (float)dOuterRadius, phi, psi, dpsi, dphi;
float* vertex, *normal;
double iradius = dInnerRadius, oradius = dOuterRadius, phi, psi, dpsi, dphi;
double *vertex, *normal;
int i, j;
float spsi, cpsi, sphi, cphi ;
double spsi, cpsi, sphi, cphi ;
/*
* Allocate the vertices array
*/
vertex = calloc( sizeof(float), 3 * nSides * nRings );
normal = calloc( sizeof(float), 3 * nSides * nRings );
vertex = calloc( sizeof(double), 3 * nSides * nRings );
normal = calloc( sizeof(double), 3 * nSides * nRings );
glPushMatrix();
dpsi = 2.0 * M_PI / (float)nRings ;
dphi = 2.0 * M_PI / (float)nSides ;
dpsi = 2.0 * M_PI / (double)nRings ;
dphi = 2.0 * M_PI / (double)nSides ;
psi = 0.0;
for( j=0; j<nRings; j++ )
{
cpsi = (float)cos ( psi ) ;
spsi = (float)sin ( psi ) ;
cpsi = cos ( psi ) ;
spsi = sin ( psi ) ;
phi = 0.0;
for( i=0; i<nSides; i++ )
{
int offset = 3 * ( j * nSides + i ) ;
cphi = (float)cos ( phi ) ;
sphi = (float)sin ( phi ) ;
cphi = cos ( phi ) ;
sphi = sin ( phi ) ;
*(vertex + offset + 0) = cpsi * ( oradius + cphi * iradius ) ;
*(vertex + offset + 1) = spsi * ( oradius + cphi * iradius ) ;
*(vertex + offset + 2) = sphi * iradius ;
@ -537,8 +537,8 @@ void FGAPIENTRY glutWireTorus( GLdouble dInnerRadius, GLdouble dOuterRadius, GLi
for( j=0; j<nRings; j++ )
{
int offset = 3 * ( j * nSides + i ) ;
glNormal3fv( normal + offset );
glVertex3fv( vertex + offset );
glNormal3dv( normal + offset );
glVertex3dv( vertex + offset );
}
glEnd();
@ -551,8 +551,8 @@ void FGAPIENTRY glutWireTorus( GLdouble dInnerRadius, GLdouble dOuterRadius, GLi
for( i=0; i<nSides; i++ )
{
int offset = 3 * ( j * nSides + i ) ;
glNormal3fv( normal + offset );
glVertex3fv( vertex + offset );
glNormal3dv( normal + offset );
glVertex3dv( vertex + offset );
}
glEnd();
@ -568,10 +568,10 @@ void FGAPIENTRY glutWireTorus( GLdouble dInnerRadius, GLdouble dOuterRadius, GLi
*/
void FGAPIENTRY glutSolidTorus( GLdouble dInnerRadius, GLdouble dOuterRadius, GLint nSides, GLint nRings )
{
float iradius = (float) dInnerRadius, oradius = (float)dOuterRadius, phi, psi, dpsi, dphi;
float* vertex, *normal;
double iradius = dInnerRadius, oradius = dOuterRadius, phi, psi, dpsi, dphi;
double *vertex, *normal;
int i, j;
float spsi, cpsi, sphi, cphi ;
double spsi, cpsi, sphi, cphi ;
/*
* Increment the number of sides and rings to allow for one more point than surface
@ -582,26 +582,26 @@ void FGAPIENTRY glutSolidTorus( GLdouble dInnerRadius, GLdouble dOuterRadius, GL
/*
* Allocate the vertices array
*/
vertex = calloc( sizeof(float), 3 * nSides * nRings );
normal = calloc( sizeof(float), 3 * nSides * nRings );
vertex = calloc( sizeof(double), 3 * nSides * nRings );
normal = calloc( sizeof(double), 3 * nSides * nRings );
glPushMatrix();
dpsi = 2.0 * M_PI / (float)(nRings - 1) ;
dphi = 2.0 * M_PI / (float)(nSides - 1) ;
dpsi = 2.0 * M_PI / (double)(nRings - 1) ;
dphi = 2.0 * M_PI / (double)(nSides - 1) ;
psi = 0.0;
for( j=0; j<nRings; j++ )
{
cpsi = (float)cos ( psi ) ;
spsi = (float)sin ( psi ) ;
cpsi = cos ( psi ) ;
spsi = sin ( psi ) ;
phi = 0.0;
for( i=0; i<nSides; i++ )
{
int offset = 3 * ( j * nSides + i ) ;
cphi = (float)cos ( phi ) ;
sphi = (float)sin ( phi ) ;
cphi = cos ( phi ) ;
sphi = sin ( phi ) ;
*(vertex + offset + 0) = cpsi * ( oradius + cphi * iradius ) ;
*(vertex + offset + 1) = spsi * ( oradius + cphi * iradius ) ;
*(vertex + offset + 2) = sphi * iradius ;
@ -620,14 +620,14 @@ void FGAPIENTRY glutSolidTorus( GLdouble dInnerRadius, GLdouble dOuterRadius, GL
for( j=0; j<nRings-1; j++ )
{
int offset = 3 * ( j * nSides + i ) ;
glNormal3fv( normal + offset );
glVertex3fv( vertex + offset );
glNormal3fv( normal + offset + 3 );
glVertex3fv( vertex + offset + 3 );
glNormal3fv( normal + offset + 3 * nSides + 3 );
glVertex3fv( vertex + offset + 3 * nSides + 3 );
glNormal3fv( normal + offset + 3 * nSides );
glVertex3fv( vertex + offset + 3 * nSides );
glNormal3dv( normal + offset );
glVertex3dv( vertex + offset );
glNormal3dv( normal + offset + 3 );
glVertex3dv( vertex + offset + 3 );
glNormal3dv( normal + offset + 3 * nSides + 3 );
glVertex3dv( vertex + offset + 3 * nSides + 3 );
glNormal3dv( normal + offset + 3 * nSides );
glVertex3dv( vertex + offset + 3 * nSides );
}
}
@ -646,45 +646,45 @@ void FGAPIENTRY glutWireDodecahedron( void )
/* Magic Numbers: It is possible to create a dodecahedron by attaching two pentagons to each face of
* of a cube. The coordinates of the points are:
* (+-x,0, z); (+-1, 1, 1); (0, z, x )
* where x = 0.618033989 and z = 1.618033939.
* where x = 0.61803398875 and z = 1.61803398875.
*/
glBegin ( GL_LINE_LOOP ) ;
glNormal3f ( 0.000000f, 0.525731f, 0.850651f ) ; glVertex3f ( 0.000000f, 1.618034f, 0.618034f ) ; glVertex3f ( -1.0f, 1.0f, 1.0f ) ; glVertex3f ( -0.618034f, 0.000000f, 1.618034f ) ; glVertex3f ( 0.618034f, 0.000000f, 1.618034f ) ; glVertex3f ( 1.0f, 1.0f, 1.0f ) ;
glNormal3d ( 0.0, 0.525731, 0.850651 ) ; 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 () ;
glBegin ( GL_LINE_LOOP ) ;
glNormal3f ( 0.000000f, 0.525731f, -0.850651f ) ; glVertex3f ( 0.000000f, 1.618034f, -0.618034f ) ; glVertex3f ( 1.0f, 1.0f, -1.0f ) ; glVertex3f ( 0.618034f, 0.000000f, -1.618034f ) ; glVertex3f ( -0.618034f, 0.000000f, -1.618034f ) ; glVertex3f ( -1.0f, 1.0f, -1.0f ) ;
glNormal3d ( 0.0, 0.525731, -0.850651 ) ; 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 () ;
glBegin ( GL_LINE_LOOP ) ;
glNormal3f ( 0.000000f, -0.525731f, 0.850651f ) ; glVertex3f ( 0.000000f, -1.618034f, 0.618034f ) ; glVertex3f ( 1.0f, -1.0f, 1.0f ) ; glVertex3f ( 0.618034f, 0.000000f, 1.618034f ) ; glVertex3f ( -0.618034f, 0.000000f, 1.618034f ) ; glVertex3f ( -1.0f, -1.0f, 1.0f ) ;
glNormal3d ( 0.0, -0.525731, 0.850651 ) ; 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 () ;
glBegin ( GL_LINE_LOOP ) ;
glNormal3f ( 0.000000f, -0.525731f, -0.850651f ) ; glVertex3f ( 0.000000f, -1.618034f, -0.618034f ) ; glVertex3f ( -1.0f, -1.0f, -1.0f ) ; glVertex3f ( -0.618034f, 0.000000f, -1.618034f ) ; glVertex3f ( 0.618034f, 0.000000f, -1.618034f ) ; glVertex3f ( 1.0f, -1.0f, -1.0f ) ;
glNormal3d ( 0.0, -0.525731, -0.850651 ) ; 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 () ;
glBegin ( GL_LINE_LOOP ) ;
glNormal3f ( 0.850651f, 0.000000f, 0.525731f ) ; glVertex3f ( 0.618034f, 0.000000f, 1.618034f ) ; glVertex3f ( 1.0f, -1.0f, 1.0f ) ; glVertex3f ( 1.618034f, -0.618034f, 0.000000f ) ; glVertex3f ( 1.618034f, 0.618034f, 0.000000f ) ; glVertex3f ( 1.0f, 1.0f, 1.0f ) ;
glNormal3d ( 0.850651, 0.0, 0.525731 ) ; 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 () ;
glBegin ( GL_LINE_LOOP ) ;
glNormal3f ( -0.850651f, 0.000000f, 0.525731f ) ; glVertex3f ( -0.618034f, 0.000000f, 1.618034f ) ; glVertex3f ( -1.0f, 1.0f, 1.0f ) ; glVertex3f ( -1.618034f, 0.618034f, 0.000000f ) ; glVertex3f ( -1.618034f, -0.618034f, 0.000000f ) ; glVertex3f ( -1.0f, -1.0f, 1.0f ) ;
glNormal3d ( -0.850651, 0.0, 0.525731 ) ; 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 () ;
glBegin ( GL_LINE_LOOP ) ;
glNormal3f ( 0.850651f, 0.000000f, -0.525731f ) ; glVertex3f ( 0.618034f, 0.000000f, -1.618034f ) ; glVertex3f ( 1.0f, 1.0f, -1.0f ) ; glVertex3f ( 1.618034f, 0.618034f, 0.000000f ) ; glVertex3f ( 1.618034f, -0.618034f, 0.000000f ) ; glVertex3f ( 1.0f, -1.0f, -1.0f ) ;
glNormal3d ( 0.850651, 0.0, -0.525731 ) ; 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 () ;
glBegin ( GL_LINE_LOOP ) ;
glNormal3f ( -0.850651f, 0.000000f, -0.525731f ) ; glVertex3f ( -0.618034f, 0.000000f, -1.618034f ) ; glVertex3f ( -1.0f, -1.0f, -1.0f ) ; glVertex3f ( -1.618034f, -0.618034f, 0.000000f ) ; glVertex3f ( -1.618034f, 0.618034f, 0.000000f ) ; glVertex3f ( -1.0f, 1.0f, -1.0f ) ;
glNormal3d ( -0.850651, 0.0, -0.525731 ) ; 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 () ;
glBegin ( GL_LINE_LOOP ) ;
glNormal3f ( 0.525731f, 0.850651f, 0.000000f ) ; glVertex3f ( 1.618034f, 0.618034f, 0.000000f ) ; glVertex3f ( 1.0f, 1.0f, -1.0f ) ; glVertex3f ( 0.000000f, 1.618034f, -0.618034f ) ; glVertex3f ( 0.000000f, 1.618034f, 0.618034f ) ; glVertex3f ( 1.0f, 1.0f, 1.0f ) ;
glNormal3d ( 0.525731, 0.850651, 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 () ;
glBegin ( GL_LINE_LOOP ) ;
glNormal3f ( 0.525731f, -0.850651f, 0.000000f ) ; glVertex3f ( 1.618034f, -0.618034f, 0.000000f ) ; glVertex3f ( 1.0f, -1.0f, 1.0f ) ; glVertex3f ( 0.000000f, -1.618034f, 0.618034f ) ; glVertex3f ( 0.000000f, -1.618034f, -0.618034f ) ; glVertex3f ( 1.0f, -1.0f, -1.0f ) ;
glNormal3d ( 0.525731, -0.850651, 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 () ;
glBegin ( GL_LINE_LOOP ) ;
glNormal3f ( -0.525731f, 0.850651f, 0.000000f ) ; glVertex3f ( -1.618034f, 0.618034f, 0.000000f ) ; glVertex3f ( -1.0f, 1.0f, 1.0f ) ; glVertex3f ( 0.000000f, 1.618034f, 0.618034f ) ; glVertex3f ( 0.000000f, 1.618034f, -0.618034f ) ; glVertex3f ( -1.0f, 1.0f, -1.0f ) ;
glNormal3d ( -0.525731, 0.850651, 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 () ;
glBegin ( GL_LINE_LOOP ) ;
glNormal3f ( -0.525731f, -0.850651f, 0.000000f ) ; glVertex3f ( -1.618034f, -0.618034f, 0.000000f ) ; glVertex3f ( -1.0f, -1.0f, -1.0f ) ; glVertex3f ( 0.000000f, -1.618034f, -0.618034f ) ; glVertex3f ( 0.000000f, -1.618034f, 0.618034f ) ; glVertex3f ( -1.0f, -1.0f, 1.0f ) ;
glNormal3d ( -0.525731, -0.850651, 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 () ;
}
@ -696,45 +696,45 @@ void FGAPIENTRY glutSolidDodecahedron( void )
/* Magic Numbers: It is possible to create a dodecahedron by attaching two pentagons to each face of
* of a cube. The coordinates of the points are:
* (+-x,0, z); (+-1, 1, 1); (0, z, x )
* where x = 0.618033989 and z = 1.618033939.
* where x = 0.61803398875 and z = 1.61803398875.
*/
glBegin ( GL_POLYGON ) ;
glNormal3f ( 0.000000f, 0.525731f, 0.850651f ) ; glVertex3f ( 0.000000f, 1.618034f, 0.618034f ) ; glVertex3f ( -1.0f, 1.0f, 1.0f ) ; glVertex3f ( -0.618034f, 0.000000f, 1.618034f ) ; glVertex3f ( 0.618034f, 0.000000f, 1.618034f ) ; glVertex3f ( 1.0f, 1.0f, 1.0f ) ;
glNormal3d ( 0.0, 0.525731, 0.850651 ) ; 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 () ;
glBegin ( GL_POLYGON ) ;
glNormal3f ( 0.000000f, 0.525731f, -0.850651f ) ; glVertex3f ( 0.000000f, 1.618034f, -0.618034f ) ; glVertex3f ( 1.0f, 1.0f, -1.0f ) ; glVertex3f ( 0.618034f, 0.000000f, -1.618034f ) ; glVertex3f ( -0.618034f, 0.000000f, -1.618034f ) ; glVertex3f ( -1.0f, 1.0f, -1.0f ) ;
glNormal3d ( 0.0, 0.525731, -0.850651 ) ; 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 () ;
glBegin ( GL_POLYGON ) ;
glNormal3f ( 0.000000f, -0.525731f, 0.850651f ) ; glVertex3f ( 0.000000f, -1.618034f, 0.618034f ) ; glVertex3f ( 1.0f, -1.0f, 1.0f ) ; glVertex3f ( 0.618034f, 0.000000f, 1.618034f ) ; glVertex3f ( -0.618034f, 0.000000f, 1.618034f ) ; glVertex3f ( -1.0f, -1.0f, 1.0f ) ;
glNormal3d ( 0.0, -0.525731, 0.850651 ) ; 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 () ;
glBegin ( GL_POLYGON ) ;
glNormal3f ( 0.000000f, -0.525731f, -0.850651f ) ; glVertex3f ( 0.000000f, -1.618034f, -0.618034f ) ; glVertex3f ( -1.0f, -1.0f, -1.0f ) ; glVertex3f ( -0.618034f, 0.000000f, -1.618034f ) ; glVertex3f ( 0.618034f, 0.000000f, -1.618034f ) ; glVertex3f ( 1.0f, -1.0f, -1.0f ) ;
glNormal3d ( 0.0, -0.525731, -0.850651 ) ; 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 () ;
glBegin ( GL_POLYGON ) ;
glNormal3f ( 0.850651f, 0.000000f, 0.525731f ) ; glVertex3f ( 0.618034f, 0.000000f, 1.618034f ) ; glVertex3f ( 1.0f, -1.0f, 1.0f ) ; glVertex3f ( 1.618034f, -0.618034f, 0.000000f ) ; glVertex3f ( 1.618034f, 0.618034f, 0.000000f ) ; glVertex3f ( 1.0f, 1.0f, 1.0f ) ;
glNormal3d ( 0.850651, 0.0, 0.525731 ) ; 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 () ;
glBegin ( GL_POLYGON ) ;
glNormal3f ( -0.850651f, 0.000000f, 0.525731f ) ; glVertex3f ( -0.618034f, 0.000000f, 1.618034f ) ; glVertex3f ( -1.0f, 1.0f, 1.0f ) ; glVertex3f ( -1.618034f, 0.618034f, 0.000000f ) ; glVertex3f ( -1.618034f, -0.618034f, 0.000000f ) ; glVertex3f ( -1.0f, -1.0f, 1.0f ) ;
glNormal3d ( -0.850651, 0.0, 0.525731 ) ; 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 () ;
glBegin ( GL_POLYGON ) ;
glNormal3f ( 0.850651f, 0.000000f, -0.525731f ) ; glVertex3f ( 0.618034f, 0.000000f, -1.618034f ) ; glVertex3f ( 1.0f, 1.0f, -1.0f ) ; glVertex3f ( 1.618034f, 0.618034f, 0.000000f ) ; glVertex3f ( 1.618034f, -0.618034f, 0.000000f ) ; glVertex3f ( 1.0f, -1.0f, -1.0f ) ;
glNormal3d ( 0.850651, 0.0, -0.525731 ) ; 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 () ;
glBegin ( GL_POLYGON ) ;
glNormal3f ( -0.850651f, 0.000000f, -0.525731f ) ; glVertex3f ( -0.618034f, 0.000000f, -1.618034f ) ; glVertex3f ( -1.0f, -1.0f, -1.0f ) ; glVertex3f ( -1.618034f, -0.618034f, 0.000000f ) ; glVertex3f ( -1.618034f, 0.618034f, 0.000000f ) ; glVertex3f ( -1.0f, 1.0f, -1.0f ) ;
glNormal3d ( -0.850651, 0.0, -0.525731 ) ; 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 () ;
glBegin ( GL_POLYGON ) ;
glNormal3f ( 0.525731f, 0.850651f, 0.000000f ) ; glVertex3f ( 1.618034f, 0.618034f, 0.000000f ) ; glVertex3f ( 1.0f, 1.0f, -1.0f ) ; glVertex3f ( 0.000000f, 1.618034f, -0.618034f ) ; glVertex3f ( 0.000000f, 1.618034f, 0.618034f ) ; glVertex3f ( 1.0f, 1.0f, 1.0f ) ;
glNormal3d ( 0.525731, 0.850651, 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 () ;
glBegin ( GL_POLYGON ) ;
glNormal3f ( 0.525731f, -0.850651f, 0.000000f ) ; glVertex3f ( 1.618034f, -0.618034f, 0.000000f ) ; glVertex3f ( 1.0f, -1.0f, 1.0f ) ; glVertex3f ( 0.000000f, -1.618034f, 0.618034f ) ; glVertex3f ( 0.000000f, -1.618034f, -0.618034f ) ; glVertex3f ( 1.0f, -1.0f, -1.0f ) ;
glNormal3d ( 0.525731, -0.850651, 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 () ;
glBegin ( GL_POLYGON ) ;
glNormal3f ( -0.525731f, 0.850651f, 0.000000f ) ; glVertex3f ( -1.618034f, 0.618034f, 0.000000f ) ; glVertex3f ( -1.0f, 1.0f, 1.0f ) ; glVertex3f ( 0.000000f, 1.618034f, 0.618034f ) ; glVertex3f ( 0.000000f, 1.618034f, -0.618034f ) ; glVertex3f ( -1.0f, 1.0f, -1.0f ) ;
glNormal3d ( -0.525731, 0.850651, 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 () ;
glBegin ( GL_POLYGON ) ;
glNormal3f ( -0.525731f, -0.850651f, 0.000000f ) ; glVertex3f ( -1.618034f, -0.618034f, 0.000000f ) ; glVertex3f ( -1.0f, -1.0f, -1.0f ) ; glVertex3f ( 0.000000f, -1.618034f, -0.618034f ) ; glVertex3f ( 0.000000f, -1.618034f, 0.618034f ) ; glVertex3f ( -1.0f, -1.0f, 1.0f ) ;
glNormal3d ( -0.525731, -0.850651, 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 () ;
}
@ -745,14 +745,14 @@ void FGAPIENTRY glutWireOctahedron( void )
{
#define RADIUS 1.0f
glBegin( GL_LINE_LOOP );
glNormal3f( 0.577350f, 0.577350f, 0.577350f); glVertex3f( RADIUS, 0.0f, 0.0f ); glVertex3f( 0.0f, RADIUS, 0.0f ); glVertex3f( 0.0f, 0.0f, RADIUS );
glNormal3f( 0.577350f, 0.577350f,-0.577350f); glVertex3f( RADIUS, 0.0f, 0.0f ); glVertex3f( 0.0f, RADIUS, 0.0f ); glVertex3f( 0.0f, 0.0f,-RADIUS );
glNormal3f( 0.577350f,-0.577350f, 0.577350f); glVertex3f( RADIUS, 0.0f, 0.0f ); glVertex3f( 0.0f,-RADIUS, 0.0f ); glVertex3f( 0.0f, 0.0f, RADIUS );
glNormal3f( 0.577350f,-0.577350f,-0.577350f); glVertex3f( RADIUS, 0.0f, 0.0f ); glVertex3f( 0.0f,-RADIUS, 0.0f ); glVertex3f( 0.0f, 0.0f,-RADIUS );
glNormal3f(-0.577350f, 0.577350f, 0.577350f); glVertex3f(-RADIUS, 0.0f, 0.0f ); glVertex3f( 0.0f, RADIUS, 0.0f ); glVertex3f( 0.0f, 0.0f, RADIUS );
glNormal3f(-0.577350f, 0.577350f,-0.577350f); glVertex3f(-RADIUS, 0.0f, 0.0f ); glVertex3f( 0.0f, RADIUS, 0.0f ); glVertex3f( 0.0f, 0.0f,-RADIUS );
glNormal3f(-0.577350f,-0.577350f, 0.577350f); glVertex3f(-RADIUS, 0.0f, 0.0f ); glVertex3f( 0.0f,-RADIUS, 0.0f ); glVertex3f( 0.0f, 0.0f, RADIUS );
glNormal3f(-0.577350f,-0.577350f,-0.577350f); glVertex3f(-RADIUS, 0.0f, 0.0f ); glVertex3f( 0.0f,-RADIUS, 0.0f ); glVertex3f( 0.0f, 0.0f,-RADIUS );
glNormal3d( 0.577350, 0.577350, 0.577350f); glVertex3d( RADIUS, 0.0, 0.0 ); glVertex3d( 0.0, RADIUS, 0.0 ); glVertex3d( 0.0, 0.0, RADIUS );
glNormal3d( 0.577350, 0.577350,-0.577350f); glVertex3d( RADIUS, 0.0, 0.0 ); glVertex3d( 0.0, RADIUS, 0.0 ); glVertex3d( 0.0, 0.0,-RADIUS );
glNormal3d( 0.577350,-0.577350, 0.577350f); glVertex3d( RADIUS, 0.0, 0.0 ); glVertex3d( 0.0,-RADIUS, 0.0 ); glVertex3d( 0.0, 0.0, RADIUS );
glNormal3d( 0.577350,-0.577350,-0.577350f); glVertex3d( RADIUS, 0.0, 0.0 ); glVertex3d( 0.0,-RADIUS, 0.0 ); glVertex3d( 0.0, 0.0,-RADIUS );
glNormal3d(-0.577350, 0.577350, 0.577350f); glVertex3d(-RADIUS, 0.0, 0.0 ); glVertex3d( 0.0, RADIUS, 0.0 ); glVertex3d( 0.0, 0.0, RADIUS );
glNormal3d(-0.577350, 0.577350,-0.577350f); glVertex3d(-RADIUS, 0.0, 0.0 ); glVertex3d( 0.0, RADIUS, 0.0 ); glVertex3d( 0.0, 0.0,-RADIUS );
glNormal3d(-0.577350,-0.577350, 0.577350f); glVertex3d(-RADIUS, 0.0, 0.0 ); glVertex3d( 0.0,-RADIUS, 0.0 ); glVertex3d( 0.0, 0.0, RADIUS );
glNormal3d(-0.577350,-0.577350,-0.577350f); glVertex3d(-RADIUS, 0.0, 0.0 ); glVertex3d( 0.0,-RADIUS, 0.0 ); glVertex3d( 0.0, 0.0,-RADIUS );
glEnd();
#undef RADIUS
}
@ -764,14 +764,14 @@ void FGAPIENTRY glutSolidOctahedron( void )
{
#define RADIUS 1.0f
glBegin( GL_TRIANGLES );
glNormal3f( 0.577350f, 0.577350f, 0.577350f); glVertex3f( RADIUS, 0.0f, 0.0f ); glVertex3f( 0.0f, RADIUS, 0.0f ); glVertex3f( 0.0f, 0.0f, RADIUS );
glNormal3f( 0.577350f, 0.577350f,-0.577350f); glVertex3f( RADIUS, 0.0f, 0.0f ); glVertex3f( 0.0f, RADIUS, 0.0f ); glVertex3f( 0.0f, 0.0f,-RADIUS );
glNormal3f( 0.577350f,-0.577350f, 0.577350f); glVertex3f( RADIUS, 0.0f, 0.0f ); glVertex3f( 0.0f,-RADIUS, 0.0f ); glVertex3f( 0.0f, 0.0f, RADIUS );
glNormal3f( 0.577350f,-0.577350f,-0.577350f); glVertex3f( RADIUS, 0.0f, 0.0f ); glVertex3f( 0.0f,-RADIUS, 0.0f ); glVertex3f( 0.0f, 0.0f,-RADIUS );
glNormal3f(-0.577350f, 0.577350f, 0.577350f); glVertex3f(-RADIUS, 0.0f, 0.0f ); glVertex3f( 0.0f, RADIUS, 0.0f ); glVertex3f( 0.0f, 0.0f, RADIUS );
glNormal3f(-0.577350f, 0.577350f,-0.577350f); glVertex3f(-RADIUS, 0.0f, 0.0f ); glVertex3f( 0.0f, RADIUS, 0.0f ); glVertex3f( 0.0f, 0.0f,-RADIUS );
glNormal3f(-0.577350f,-0.577350f, 0.577350f); glVertex3f(-RADIUS, 0.0f, 0.0f ); glVertex3f( 0.0f,-RADIUS, 0.0f ); glVertex3f( 0.0f, 0.0f, RADIUS );
glNormal3f(-0.577350f,-0.577350f,-0.577350f); glVertex3f(-RADIUS, 0.0f, 0.0f ); glVertex3f( 0.0f,-RADIUS, 0.0f ); glVertex3f( 0.0f, 0.0f,-RADIUS );
glNormal3d( 0.577350, 0.577350, 0.577350f); glVertex3d( RADIUS, 0.0, 0.0 ); glVertex3d( 0.0, RADIUS, 0.0 ); glVertex3d( 0.0, 0.0, RADIUS );
glNormal3d( 0.577350, 0.577350,-0.577350f); glVertex3d( RADIUS, 0.0, 0.0 ); glVertex3d( 0.0, RADIUS, 0.0 ); glVertex3d( 0.0, 0.0,-RADIUS );
glNormal3d( 0.577350,-0.577350, 0.577350f); glVertex3d( RADIUS, 0.0, 0.0 ); glVertex3d( 0.0,-RADIUS, 0.0 ); glVertex3d( 0.0, 0.0, RADIUS );
glNormal3d( 0.577350,-0.577350,-0.577350f); glVertex3d( RADIUS, 0.0, 0.0 ); glVertex3d( 0.0,-RADIUS, 0.0 ); glVertex3d( 0.0, 0.0,-RADIUS );
glNormal3d(-0.577350, 0.577350, 0.577350f); glVertex3d(-RADIUS, 0.0, 0.0 ); glVertex3d( 0.0, RADIUS, 0.0 ); glVertex3d( 0.0, 0.0, RADIUS );
glNormal3d(-0.577350, 0.577350,-0.577350f); glVertex3d(-RADIUS, 0.0, 0.0 ); glVertex3d( 0.0, RADIUS, 0.0 ); glVertex3d( 0.0, 0.0,-RADIUS );
glNormal3d(-0.577350,-0.577350, 0.577350f); glVertex3d(-RADIUS, 0.0, 0.0 ); glVertex3d( 0.0,-RADIUS, 0.0 ); glVertex3d( 0.0, 0.0, RADIUS );
glNormal3d(-0.577350,-0.577350,-0.577350f); glVertex3d(-RADIUS, 0.0, 0.0 ); glVertex3d( 0.0,-RADIUS, 0.0 ); glVertex3d( 0.0, 0.0,-RADIUS );
glEnd();
#undef RADIUS
}
@ -791,16 +791,16 @@ void FGAPIENTRY glutWireTetrahedron( void )
* Normals: The unit normals are simply the negative of the coordinates of the point not on the surface.
*/
float r0[3] = { 1.0f, 0.0f, 0.0f } ;
float r1[3] = { -0.333333f, 0.942809f, 0.0f } ;
float r2[3] = { -0.333333f, -0.471405f, 0.816497f } ;
float r3[3] = { -0.333333f, -0.471405f, -0.816497f } ;
double r0[3] = { 1.0, 0.0, 0.0 } ;
double r1[3] = { -0.333333, 0.942809, 0.0 } ;
double r2[3] = { -0.333333, -0.471405, 0.816497 } ;
double r3[3] = { -0.333333, -0.471405, -0.816497 } ;
glBegin( GL_LINE_LOOP ) ;
glNormal3f ( -1.0f, 0.0f, 0.0f ) ; glVertex3fv ( r1 ) ; glVertex3fv ( r3 ) ; glVertex3fv ( r2 ) ;
glNormal3f ( 0.333333f, -0.942809f, 0.0f ) ; glVertex3fv ( r0 ) ; glVertex3fv ( r2 ) ; glVertex3fv ( r3 ) ;
glNormal3f ( 0.333333f, 0.471405f, -0.816497f ) ; glVertex3fv ( r0 ) ; glVertex3fv ( r3 ) ; glVertex3fv ( r1 ) ;
glNormal3f ( 0.333333f, 0.471405f, 0.816497f ) ; glVertex3fv ( r0 ) ; glVertex3fv ( r1 ) ; glVertex3fv ( r2 ) ;
glNormal3d ( -1.0, 0.0, 0.0 ) ; glVertex3dv ( r1 ) ; glVertex3dv ( r3 ) ; glVertex3dv ( r2 ) ;
glNormal3d ( 0.333333, -0.942809, 0.0 ) ; glVertex3dv ( r0 ) ; glVertex3dv ( r2 ) ; glVertex3dv ( r3 ) ;
glNormal3d ( 0.333333, 0.471405, -0.816497 ) ; glVertex3dv ( r0 ) ; glVertex3dv ( r3 ) ; glVertex3dv ( r1 ) ;
glNormal3d ( 0.333333, 0.471405, 0.816497 ) ; glVertex3dv ( r0 ) ; glVertex3dv ( r1 ) ; glVertex3dv ( r2 ) ;
glEnd() ;
}
@ -819,26 +819,26 @@ void FGAPIENTRY glutSolidTetrahedron( void )
* Normals: The unit normals are simply the negative of the coordinates of the point not on the surface.
*/
float r0[3] = { 1.0f, 0.0f, 0.0f } ;
float r1[3] = { -0.333333f, 0.942809f, 0.0f } ;
float r2[3] = { -0.333333f, -0.471405f, 0.816497f } ;
float r3[3] = { -0.333333f, -0.471405f, -0.816497f } ;
double r0[3] = { 1.0, 0.0, 0.0 } ;
double r1[3] = { -0.333333, 0.942809, 0.0 } ;
double r2[3] = { -0.333333, -0.471405, 0.816497 } ;
double r3[3] = { -0.333333, -0.471405, -0.816497 } ;
glBegin( GL_TRIANGLES ) ;
glNormal3f ( -1.0f, 0.0f, 0.0f ) ; glVertex3fv ( r1 ) ; glVertex3fv ( r3 ) ; glVertex3fv ( r2 ) ;
glNormal3f ( 0.333333f, -0.942809f, 0.0f ) ; glVertex3fv ( r0 ) ; glVertex3fv ( r2 ) ; glVertex3fv ( r3 ) ;
glNormal3f ( 0.333333f, 0.471405f, -0.816497f ) ; glVertex3fv ( r0 ) ; glVertex3fv ( r3 ) ; glVertex3fv ( r1 ) ;
glNormal3f ( 0.333333f, 0.471405f, 0.816497f ) ; glVertex3fv ( r0 ) ; glVertex3fv ( r1 ) ; glVertex3fv ( r2 ) ;
glNormal3d ( -1.0, 0.0, 0.0 ) ; glVertex3dv ( r1 ) ; glVertex3dv ( r3 ) ; glVertex3dv ( r2 ) ;
glNormal3d ( 0.333333, -0.942809, 0.0 ) ; glVertex3dv ( r0 ) ; glVertex3dv ( r2 ) ; glVertex3dv ( r3 ) ;
glNormal3d ( 0.333333, 0.471405, -0.816497 ) ; glVertex3dv ( r0 ) ; glVertex3dv ( r3 ) ; glVertex3dv ( r1 ) ;
glNormal3d ( 0.333333, 0.471405, 0.816497 ) ; glVertex3dv ( r0 ) ; glVertex3dv ( r1 ) ; glVertex3dv ( r2 ) ;
glEnd() ;
}
/*
*
*/
float icos_r[12][3] = { { 1.0f, 0.0f, 0.0f },
{ 0.447214f, 0.894427f, 0.0f }, { 0.447214f, 0.276393f, 0.850651f }, { 0.447214f, -0.723607f, 0.525731f }, { 0.447214f, -0.723607f, -0.525731f }, { 0.447214f, 0.276393f, -0.850651f },
{ -0.447214f, -0.894427f, 0.0f }, { -0.447214f, -0.276393f, 0.850651f }, { -0.447214f, 0.723607f, 0.525731f }, { -0.447214f, 0.723607f, -0.525731f }, { -0.447214f, -0.276393f, -0.850651f },
{ -1.0f, 0.0f, 0.0f } } ;
double icos_r[12][3] = { { 1.0, 0.0, 0.0 },
{ 0.447214, 0.894427, 0.0 }, { 0.447214, 0.276393, 0.850651 }, { 0.447214, -0.723607, 0.525731 }, { 0.447214, -0.723607, -0.525731 }, { 0.447214, 0.276393, -0.850651 },
{ -0.447214, -0.894427, 0.0 }, { -0.447214, -0.276393, 0.850651 }, { -0.447214, 0.723607, 0.525731 }, { -0.447214, 0.723607, -0.525731 }, { -0.447214, -0.276393, -0.850651 },
{ -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 },
{ 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 },
@ -849,15 +849,15 @@ void FGAPIENTRY glutWireIcosahedron( void )
int i ;
for ( i = 0; i < 20; i++ )
{
float 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[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] ) ;
glBegin ( GL_LINE_LOOP ) ;
glNormal3fv ( normal ) ;
glVertex3fv ( icos_r[icos_v[i][0]] ) ;
glVertex3fv ( icos_r[icos_v[i][1]] ) ;
glVertex3fv ( icos_r[icos_v[i][2]] ) ;
glNormal3dv ( normal ) ;
glVertex3dv ( icos_r[icos_v[i][0]] ) ;
glVertex3dv ( icos_r[icos_v[i][1]] ) ;
glVertex3dv ( icos_r[icos_v[i][2]] ) ;
glEnd () ;
}
}
@ -872,14 +872,14 @@ void FGAPIENTRY glutSolidIcosahedron( void )
glBegin ( GL_TRIANGLES ) ;
for ( i = 0; i < 20; i++ )
{
float 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[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] ) ;
glNormal3fv ( normal ) ;
glVertex3fv ( icos_r[icos_v[i][0]] ) ;
glVertex3fv ( icos_r[icos_v[i][1]] ) ;
glVertex3fv ( icos_r[icos_v[i][2]] ) ;
glNormal3dv ( normal ) ;
glVertex3dv ( icos_r[icos_v[i][0]] ) ;
glVertex3dv ( icos_r[icos_v[i][1]] ) ;
glVertex3dv ( icos_r[icos_v[i][2]] ) ;
}
glEnd () ;
@ -888,18 +888,18 @@ void FGAPIENTRY glutSolidIcosahedron( void )
/*
*
*/
float rdod_r[14][3] = { { 0.0f, 0.0f, 1.0f },
{ 0.707107f, 0.000000f, 0.5f }, { 0.000000f, 0.707107f, 0.5f }, { -0.707107f, 0.000000f, 0.5f }, { 0.000000f, -0.707107f, 0.5f },
{ 0.707107f, 0.707107f, 0.0f }, { -0.707107f, 0.707107f, 0.0f }, { -0.707107f, -0.707107f, 0.0f }, { 0.707107f, -0.707107f, 0.0f },
{ 0.707107f, 0.000000f, -0.5f }, { 0.000000f, 0.707107f, -0.5f }, { -0.707107f, 0.000000f, -0.5f }, { 0.000000f, -0.707107f, -0.5f },
{ 0.0f, 0.0f, -1.0f } } ;
double rdod_r[14][3] = { { 0.0, 0.0, 1.0 },
{ 0.707107, 0.000000, 0.5 }, { 0.000000, 0.707107, 0.5 }, { -0.707107, 0.000000, 0.5 }, { 0.000000, -0.707107, 0.5 },
{ 0.707107, 0.707107, 0.0 }, { -0.707107, 0.707107, 0.0 }, { -0.707107, -0.707107, 0.0 }, { 0.707107, -0.707107, 0.0 },
{ 0.707107, 0.000000, -0.5 }, { 0.000000, 0.707107, -0.5 }, { -0.707107, 0.000000, -0.5 }, { 0.000000, -0.707107, -0.5 },
{ 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 },
{ 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 } } ;
float rdod_n[12][3] = {
{ 0.353553f, 0.353553f, 0.5f }, { -0.353553f, 0.353553f, 0.5f }, { -0.353553f, -0.353553f, 0.5f }, { 0.353553f, -0.353553f, 0.5f },
{ 0.000000f, 1.000000f, 0.0f }, { -1.000000f, 0.000000f, 0.0f }, { 0.000000f, -1.000000f, 0.0f }, { 1.000000f, 0.000000f, 0.0f },
{ 0.353553f, 0.353553f, -0.5f }, { -0.353553f, 0.353553f, -0.5f }, { -0.353553f, -0.353553f, -0.5f }, { 0.353553f, -0.353553f, -0.5f }
double rdod_n[12][3] = {
{ 0.353553, 0.353553, 0.5 }, { -0.353553, 0.353553, 0.5 }, { -0.353553, -0.353553, 0.5 }, { 0.353553, -0.353553, 0.5 },
{ 0.000000, 1.000000, 0.0 }, { -1.000000, 0.000000, 0.0 }, { 0.000000, -1.000000, 0.0 }, { 1.000000, 0.000000, 0.0 },
{ 0.353553, 0.353553, -0.5 }, { -0.353553, 0.353553, -0.5 }, { -0.353553, -0.353553, -0.5 }, { 0.353553, -0.353553, -0.5 }
} ;
void FGAPIENTRY glutWireRhombicDodecahedron( void )
@ -908,11 +908,11 @@ void FGAPIENTRY glutWireRhombicDodecahedron( void )
for ( i = 0; i < 12; i++ )
{
glBegin ( GL_LINE_LOOP ) ;
glNormal3fv ( rdod_n[i] ) ;
glVertex3fv ( rdod_r[rdod_v[i][0]] ) ;
glVertex3fv ( rdod_r[rdod_v[i][1]] ) ;
glVertex3fv ( rdod_r[rdod_v[i][2]] ) ;
glVertex3fv ( rdod_r[rdod_v[i][3]] ) ;
glNormal3dv ( rdod_n[i] ) ;
glVertex3dv ( rdod_r[rdod_v[i][0]] ) ;
glVertex3dv ( rdod_r[rdod_v[i][1]] ) ;
glVertex3dv ( rdod_r[rdod_v[i][2]] ) ;
glVertex3dv ( rdod_r[rdod_v[i][3]] ) ;
glEnd () ;
}
}
@ -927,11 +927,11 @@ void FGAPIENTRY glutSolidRhombicDodecahedron( void )
glBegin ( GL_QUADS ) ;
for ( i = 0; i < 12; i++ )
{
glNormal3fv ( rdod_n[i] ) ;
glVertex3fv ( rdod_r[rdod_v[i][0]] ) ;
glVertex3fv ( rdod_r[rdod_v[i][1]] ) ;
glVertex3fv ( rdod_r[rdod_v[i][2]] ) ;
glVertex3fv ( rdod_r[rdod_v[i][3]] ) ;
glNormal3dv ( rdod_n[i] ) ;
glVertex3dv ( rdod_r[rdod_v[i][0]] ) ;
glVertex3dv ( rdod_r[rdod_v[i][1]] ) ;
glVertex3dv ( rdod_r[rdod_v[i][2]] ) ;
glVertex3dv ( rdod_r[rdod_v[i][3]] ) ;
}
glEnd () ;
@ -939,7 +939,7 @@ void FGAPIENTRY glutSolidRhombicDodecahedron( void )
#define NUM_FACES 4
static GLfloat tetrahedron_v[4][3] = /* Vertices */
static GLdouble tetrahedron_v[4][3] = /* Vertices */
{
{ -0.5, -0.288675134, -0.144337567 },
{ 0.5, -0.288675134, -0.144337567 },
@ -952,7 +952,7 @@ static GLint tetrahedron_i[4][3] = /* Vertex indices */
{ 0, 1, 2 }, { 0, 2, 3 }, { 0, 3, 1 }, { 1, 3, 2 }
} ;
static GLfloat tetrahedron_n[4][3] = /* Normals */
static GLdouble tetrahedron_n[4][3] = /* Normals */
{
{ 0.0, 0.0, -1.0 },
{ -0.816496581, 0.471404521, 0.333333333 },
@ -960,7 +960,7 @@ static GLfloat tetrahedron_n[4][3] = /* Normals */
{ 0.816496581, 0.471404521, 0.333333333 }
} ;
void FGAPIENTRY glutWireSierpinskiSponge ( int num_levels, GLfloat offset[3], GLfloat scale )
void FGAPIENTRY glutWireSierpinskiSponge ( int num_levels, GLdouble offset[3], GLdouble scale )
{
int i, j ;
@ -970,13 +970,13 @@ void FGAPIENTRY glutWireSierpinskiSponge ( int num_levels, GLfloat offset[3], GL
for ( i = 0 ; i < NUM_FACES ; i++ )
{
glBegin ( GL_LINE_LOOP ) ;
glNormal3fv ( tetrahedron_n[i] ) ;
glNormal3dv ( tetrahedron_n[i] ) ;
for ( j = 0; j < 3; j++ )
{
float x = offset[0] + scale * tetrahedron_v[tetrahedron_i[i][j]][0] ;
float y = offset[1] + scale * tetrahedron_v[tetrahedron_i[i][j]][1] ;
float z = offset[2] + scale * tetrahedron_v[tetrahedron_i[i][j]][2] ;
glVertex3f ( x, y, z ) ;
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 z = offset[2] + scale * tetrahedron_v[tetrahedron_i[i][j]][2] ;
glVertex3d ( x, y, z ) ;
}
glEnd () ;
@ -984,7 +984,7 @@ void FGAPIENTRY glutWireSierpinskiSponge ( int num_levels, GLfloat offset[3], GL
}
else
{
GLfloat 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 -- ;
scale /= 2.0 ;
local_offset[0] = offset[0] + scale * tetrahedron_v[0][0] ;
@ -994,15 +994,15 @@ void FGAPIENTRY glutWireSierpinskiSponge ( int num_levels, GLfloat offset[3], GL
local_offset[0] += scale ;
glutWireSierpinskiSponge ( num_levels, local_offset, scale ) ;
local_offset[0] -= 0.5 * scale ;
local_offset[1] += 0.866025403 * scale ;
local_offset[1] += 0.866025403784 * scale ;
glutWireSierpinskiSponge ( num_levels, local_offset, scale ) ;
local_offset[1] -= 0.577350269 * scale ;
local_offset[2] += 0.816496581 * scale ;
local_offset[1] -= 0.577350269189 * scale ;
local_offset[2] += 0.816496580929 * scale ;
glutWireSierpinskiSponge ( num_levels, local_offset, scale ) ;
}
}
void FGAPIENTRY glutSolidSierpinskiSponge ( int num_levels, GLfloat offset[3], GLfloat scale )
void FGAPIENTRY glutSolidSierpinskiSponge ( int num_levels, GLdouble offset[3], GLdouble scale )
{
int i, j ;
@ -1012,13 +1012,13 @@ void FGAPIENTRY glutSolidSierpinskiSponge ( int num_levels, GLfloat offset[3], G
for ( i = 0 ; i < NUM_FACES ; i++ )
{
glNormal3fv ( tetrahedron_n[i] ) ;
glNormal3dv ( tetrahedron_n[i] ) ;
for ( j = 0; j < 3; j++ )
{
float x = offset[0] + scale * tetrahedron_v[tetrahedron_i[i][j]][0] ;
float y = offset[1] + scale * tetrahedron_v[tetrahedron_i[i][j]][1] ;
float z = offset[2] + scale * tetrahedron_v[tetrahedron_i[i][j]][2] ;
glVertex3f ( x, y, z ) ;
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 z = offset[2] + scale * tetrahedron_v[tetrahedron_i[i][j]][2] ;
glVertex3d ( x, y, z ) ;
}
}
@ -1026,7 +1026,7 @@ void FGAPIENTRY glutSolidSierpinskiSponge ( int num_levels, GLfloat offset[3], G
}
else
{
GLfloat 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 -- ;
scale /= 2.0 ;
local_offset[0] = offset[0] + scale * tetrahedron_v[0][0] ;
@ -1036,10 +1036,10 @@ void FGAPIENTRY glutSolidSierpinskiSponge ( int num_levels, GLfloat offset[3], G
local_offset[0] += scale ;
glutSolidSierpinskiSponge ( num_levels, local_offset, scale ) ;
local_offset[0] -= 0.5 * scale ;
local_offset[1] += 0.866025403 * scale ;
local_offset[1] += 0.866025403784 * scale ;
glutSolidSierpinskiSponge ( num_levels, local_offset, scale ) ;
local_offset[1] -= 0.577350269 * scale ;
local_offset[2] += 0.816496581 * scale ;
local_offset[1] -= 0.577350269189 * scale ;
local_offset[2] += 0.816496580929 * scale ;
glutSolidSierpinskiSponge ( num_levels, local_offset, scale ) ;
}
}

View File

@ -80,9 +80,6 @@
#include "../include/GL/freeglut.h"
#include "freeglut_internal.h"
#ifdef TARGET_HOST_WIN32
#pragma warning ( once:4305 )
#endif
/* -- PRIVATE FUNCTIONS ---------------------------------------------------- */
@ -104,7 +101,7 @@ static int patchdata[][16] =
{ 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95 }
};
static float cpdata[][3] =
static double cpdata[][3] =
{
{0.2, 0, 2.7}, {0.2, -0.112, 2.7}, {0.112, -0.2, 2.7}, {0,
-0.2, 2.7}, {1.3375, 0, 2.53125}, {1.3375, -0.749, 2.53125},
@ -149,15 +146,15 @@ static float cpdata[][3] =
{0.84, -1.5, 0.075}
};
static float tex[2][2][2] =
static double tex[2][2][2] =
{
{ {0, 0}, {1, 0} },
{ {0, 1}, {1, 1} }
{ {0.0, 0.0}, {1.0, 0.0} },
{ {0.0, 1.0}, {1.0, 1.0} }
};
static void teapot( GLint grid, GLdouble scale, GLenum type )
{
float p[4][4][3], q[4][4][3], r[4][4][3], s[4][4][3];
double p[4][4][3], q[4][4][3], r[4][4][3], s[4][4][3];
long i, j, k, l;
glPushAttrib( GL_ENABLE_BIT | GL_EVAL_BIT );
@ -167,9 +164,9 @@ static void teapot( GLint grid, GLdouble scale, GLenum type )
glEnable( GL_MAP2_TEXTURE_COORD_2 );
glPushMatrix();
glRotatef(270.0, 1.0, 0.0, 0.0);
glRotated(270.0, 1.0, 0.0, 0.0);
glScaled(0.5 * scale, 0.5 * scale, 0.5 * scale);
glTranslatef(0.0, 0.0, -1.5);
glTranslated(0.0, 0.0, -1.5);
for (i = 0; i < 10; i++) {
for (j = 0; j < 4; j++) {
@ -194,20 +191,20 @@ static void teapot( GLint grid, GLdouble scale, GLenum type )
}
}
glMap2f(GL_MAP2_TEXTURE_COORD_2, 0, 1, 2, 2, 0, 1, 4, 2,
glMap2d(GL_MAP2_TEXTURE_COORD_2, 0.0, 1.0, 2, 2, 0.0, 1.0, 4, 2,
&tex[0][0][0]);
glMap2f(GL_MAP2_VERTEX_3, 0, 1, 3, 4, 0, 1, 12, 4,
glMap2d(GL_MAP2_VERTEX_3, 0.0, 1.0, 3, 4, 0.0, 1.0, 12, 4,
&p[0][0][0]);
glMapGrid2f(grid, 0.0, 1.0, grid, 0.0, 1.0);
glMapGrid2d(grid, 0.0, 1.0, grid, 0.0, 1.0);
glEvalMesh2(type, 0, grid, 0, grid);
glMap2f(GL_MAP2_VERTEX_3, 0, 1, 3, 4, 0, 1, 12, 4,
glMap2d(GL_MAP2_VERTEX_3, 0.0, 1.0, 3, 4, 0.0, 1.0, 12, 4,
&q[0][0][0]);
glEvalMesh2(type, 0, grid, 0, grid);
if (i < 6) {
glMap2f(GL_MAP2_VERTEX_3, 0, 1, 3, 4, 0, 1, 12, 4,
glMap2d(GL_MAP2_VERTEX_3, 0.0, 1.0, 3, 4, 0.0, 1.0, 12, 4,
&r[0][0][0]);
glEvalMesh2(type, 0, grid, 0, grid);
glMap2f(GL_MAP2_VERTEX_3, 0, 1, 3, 4, 0, 1, 12, 4,
glMap2d(GL_MAP2_VERTEX_3, 0.0, 1.0, 3, 4, 0.0, 1.0, 12, 4,
&s[0][0][0]);
glEvalMesh2(type, 0, grid, 0, grid);
}

View File

@ -46,7 +46,9 @@
#define GLUT_WINDOW_BORDER_WIDTH 0x01FA
#define GLUT_WINDOW_HEADER_HEIGHT 0x01FB
#define GLUT_VERSION 0x01FC
/*
* Process loop function, see freeglut_main.c
*/
@ -84,8 +86,8 @@ FGAPI void FGAPIENTRY glutStrokeString( void* font, const char *string );
*/
FGAPI void FGAPIENTRY glutWireRhombicDodecahedron( void );
FGAPI void FGAPIENTRY glutSolidRhombicDodecahedron( void );
FGAPI void FGAPIENTRY glutWireSierpinskiSponge ( int num_levels, GLfloat offset[3], GLfloat scale ) ;
FGAPI void FGAPIENTRY glutSolidSierpinskiSponge ( int num_levels, GLfloat offset[3], GLfloat scale ) ;
FGAPI void FGAPIENTRY glutWireSierpinskiSponge ( int num_levels, GLdouble offset[3], GLdouble scale ) ;
FGAPI void FGAPIENTRY glutSolidSierpinskiSponge ( int num_levels, GLdouble offset[3], GLdouble scale ) ;
/*
* Extension functions, see freeglut_ext.c

View File

@ -75,10 +75,6 @@
#define GLUT_API_VERSION 4
#define FREEGLUT_VERSION_1_4 1
#define VERSION_MAJOR 1
#define VERSION_MINOR 4
#define VERSION_PATCH 0
/*
* Always include OpenGL and GLU headers
*/