X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?a=blobdiff_plain;f=progs%2Fdemos%2FLorenz%2Florenz.c;h=61ae694eb452e2c4d34bf32aa716a9af8ee55876;hb=bf8878d2bbae1230b66fac2e5b12c1431194362a;hp=4f0afc1ef24ce491c7788a763b5c9e35ffe9eb9f;hpb=e150e05bf1baf832de450b3141d8fac59cfc09fb;p=freeglut diff --git a/progs/demos/Lorenz/lorenz.c b/progs/demos/Lorenz/lorenz.c index 4f0afc1..61ae694 100644 --- a/progs/demos/Lorenz/lorenz.c +++ b/progs/demos/Lorenz/lorenz.c @@ -33,6 +33,9 @@ #include #include #include +#ifdef WIN32 +#include // DUMP MEMORY LEAKS +#endif /************************************** Defined Constants ***************************************/ @@ -106,10 +109,12 @@ void advance_in_time ( double time_step, double position[3], double new_position /* GLUT callbacks */ +#define INPUT_LINE_LENGTH 80 + void key_cb ( unsigned char key, int x, int y ) { int i ; - char inputline [ 80 ] ; + char inputline [ INPUT_LINE_LENGTH ] ; switch ( key ) { @@ -137,15 +142,15 @@ void key_cb ( unsigned char key, int x, int y ) case 'm' : case 'M' : /* Modify the Lorenz parameters */ printf ( "Please enter new value for (default %lf, currently %lf): ", s0, sigma ) ; - fgets ( inputline, 79, stdin ) ; + fgets ( inputline, INPUT_LINE_LENGTH-1, stdin ) ; sscanf ( inputline, "%lf", &sigma ) ; printf ( "Please enter new value for (default %lf, currently %lf): ", b0, b ) ; - fgets ( inputline, 79, stdin ) ; + fgets ( inputline, INPUT_LINE_LENGTH-1, stdin ) ; sscanf ( inputline, "%lf", &b ) ; printf ( "Please enter new value for (default %lf, currently %lf): ", r0, r ) ; - fgets ( inputline, 79, stdin ) ; + fgets ( inputline, INPUT_LINE_LENGTH-1, stdin ) ; sscanf ( inputline, "%lf", &r ) ; break ; @@ -205,7 +210,10 @@ void mouse_cb ( int button, int updown, int x, int y ) if ( updown == GLUT_DOWN ) { double dist = 1.0e20 ; /* A very large number */ - (void) dist; /* what's this all about? */ + dist = 0.0 ; /* so we don't get "unused variable" compiler warning */ + /* The idea here is that we go into "pick" mode and pick the nearest point + to the mouse click position. Unfortunately I don't have the time to implement + it at the moment. */ } } @@ -312,7 +320,6 @@ int main ( int argc, char *argv[] ) srand ( 1023 ) ; /* Set up the OpenGL parameters */ - /* glDrawBuffer ( GL_BACK ) ;*/ glEnable ( GL_DEPTH_TEST ) ; glClearColor ( 0.0, 0.0, 0.0, 0.0 ) ; glClearDepth ( 1.0 ) ; @@ -339,6 +346,10 @@ int main ( int argc, char *argv[] ) /* Enter the GLUT main loop */ glutMainLoop () ; - return 0; +#ifdef WIN32 + _CrtDumpMemoryLeaks () ; // DUMP MEMORY LEAK INFORMATION +#endif + + return 0 ; }