X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?a=blobdiff_plain;ds=sidebyside;f=progs%2Fdemos%2FLorenz%2Florenz.c;fp=progs%2Fdemos%2FLorenz%2Florenz.c;h=f422b946b1c5c824712017fdf36cbe522a2c6427;hb=4e261743ea8a805bc32089ae412dac422670d406;hp=4f0afc1ef24ce491c7788a763b5c9e35ffe9eb9f;hpb=5a74416d8608df35bf20ef863ba3b5c22b3de485;p=freeglut diff --git a/progs/demos/Lorenz/lorenz.c b/progs/demos/Lorenz/lorenz.c index 4f0afc1..f422b94 100644 --- a/progs/demos/Lorenz/lorenz.c +++ b/progs/demos/Lorenz/lorenz.c @@ -106,10 +106,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 +139,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 +207,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 +317,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 +343,6 @@ int main ( int argc, char *argv[] ) /* Enter the GLUT main loop */ glutMainLoop () ; - return 0; + return 0 ; }