X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?a=blobdiff_plain;f=freeglut-1.3%2Ffreeglut_geometry.c;h=23ba7d6a6e31260679b939316031da39c30c9c4a;hb=94f851333015d5bbe2a8034e15d713a80a7de183;hp=f1b1dda11fa07c0a01fe11f4ab87a13eee5019ee;hpb=5045a0816bfc941f2a556e8d8af03534754843db;p=freeglut diff --git a/freeglut-1.3/freeglut_geometry.c b/freeglut-1.3/freeglut_geometry.c index f1b1dda..23ba7d6 100644 --- a/freeglut-1.3/freeglut_geometry.c +++ b/freeglut-1.3/freeglut_geometry.c @@ -32,7 +32,7 @@ #define G_LOG_DOMAIN "freeglut-geometry" #include "../include/GL/freeglut.h" -#include "../include/GL/freeglut_internal.h" +#include "freeglut_internal.h" /* * TODO BEFORE THE STABLE RELEASE: @@ -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=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) + 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 )) ; - - float* vertices = NULL; + 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 )) ; + + 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