From ec7cb181d277a1ebde9f2d3ec399cbcf18315dd0 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 23 Jun 2003 15:22:20 +0000 Subject: [PATCH] Assorted updates from John Fay. git-svn-id: svn+ssh://svn.code.sf.net/p/freeglut/code/trunk/freeglut/freeglut@94 7f0cb862-5218-0410-a997-914c9d46530a --- doc/freeglut_user_interface.html | 21 +- freeglut-1.3/freeglut_display.c | 2 +- freeglut-1.3/freeglut_gamemode.c | 42 +-- freeglut-1.3/freeglut_geometry.c | 544 +++++++++++++++++++------------------- freeglut-1.3/freeglut_teapot.c | 29 +- include/GL/freeglut_ext.h | 6 +- include/GL/glut.h | 4 - 7 files changed, 324 insertions(+), 324 deletions(-) diff --git a/doc/freeglut_user_interface.html b/doc/freeglut_user_interface.html index 2363341..77645ac 100644 --- a/doc/freeglut_user_interface.html +++ b/doc/freeglut_user_interface.html @@ -1065,7 +1065,7 @@ is not implemented in freeglut.

-The following state variables may be queried with glutGet. +The following state variables may be queried with "glutGet". The returned value is an integer.

@@ -1134,7 +1134,7 @@ These queries do not depend on the current window.

13.7  glutGetProcAddress

glutGetProcAddress returns -a pointer to a named GL or freeglut function.

+a pointer to a named GL or freeglut function.

Usage

void *glutGetProcAddress ( const char *procName ) ;

@@ -1150,8 +1150,11 @@ the application will avoid this hard dependency and be more portable and interop better with various implementations of OpenGL.

Both OpenGL functions and freeglut functions can be queried with this function.

-

NOTE: this function is not supported -in GLUT.

+

Changes From GLUT

+ +

GLUT does not include this function. +

+

14.0  Font Rendering Functions

Freeglut supports two types of font rendering:  bitmap fonts, @@ -1872,15 +1875,17 @@ GLUT State

-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 freeglut may continue +to include <GL/glut.h> in their programs. +Programs which use the freeglut-specific extensions to GLUT should include +<GL/freeglut.h>. One possible arrangement is as follows:

-#include <GL/glut.h>
 #ifdef FREEGLUT
 #include <GL/freeglut_ext.h>
+#else
+#include <GL/glut.h>
 #endif
 
diff --git a/freeglut-1.3/freeglut_display.c b/freeglut-1.3/freeglut_display.c index 834cbc6..de19841 100644 --- a/freeglut-1.3/freeglut_display.c +++ b/freeglut-1.3/freeglut_display.c @@ -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); diff --git a/freeglut-1.3/freeglut_gamemode.c b/freeglut-1.3/freeglut_gamemode.c index e9e9276..d6c6a25 100644 --- a/freeglut-1.3/freeglut_gamemode.c +++ b/freeglut-1.3/freeglut_gamemode.c @@ -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,33 +278,33 @@ 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 */ while( EnumDisplaySettings( NULL, displayModes, &devMode ) == TRUE ) - { - /* then try without Display Frequency */ - - if( fghCheckDisplayMode( devMode.dmPelsWidth, devMode.dmPelsHeight, - devMode.dmBitsPerPel, fgState.GameModeRefresh)) - { - /* - * OKi, we've found a matching display mode, remember its number and break - */ - mode = displayModes; - break; - } + { + /* then try without Display Frequency */ + + if( fghCheckDisplayMode( devMode.dmPelsWidth, devMode.dmPelsHeight, + devMode.dmBitsPerPel, fgState.GameModeRefresh)) + { + /* + * OKi, we've found a matching display mode, remember its number and break + */ + mode = displayModes; + break; + } - /* - * Switch to the next display mode, if any - */ - displayModes++; - } + /* + * Switch to the next display mode, if any + */ + displayModes++; + } } /* diff --git a/freeglut-1.3/freeglut_geometry.c b/freeglut-1.3/freeglut_geometry.c index 5fae579..ad21c8c 100644 --- a/freeglut-1.3/freeglut_geometry.c +++ b/freeglut-1.3/freeglut_geometry.c @@ -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