---------------------------------------------------------------------------- */
| 272 | |
| 273 | /* ---------------------------------------------------------------------------- */ |
| 274 | void do_motion (void) |
| 275 | { |
| 276 | static GLint prev_time = 0; |
| 277 | static GLint prev_fps_time = 0; |
| 278 | static int frames = 0; |
| 279 | |
| 280 | int time = glutGet(GLUT_ELAPSED_TIME); |
| 281 | angle += (float)((time-prev_time)*0.01); |
| 282 | prev_time = time; |
| 283 | |
| 284 | frames += 1; |
| 285 | if ((time - prev_fps_time) > 1000) /* update every seconds */ |
| 286 | { |
| 287 | int current_fps = frames * 1000 / (time - prev_fps_time); |
| 288 | printf("%d fps\n", current_fps); |
| 289 | frames = 0; |
| 290 | prev_fps_time = time; |
| 291 | } |
| 292 | |
| 293 | |
| 294 | glutPostRedisplay (); |
| 295 | } |
| 296 | |
| 297 | /* ---------------------------------------------------------------------------- */ |
| 298 | void display(void) |