Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <GL/glut.h>
- /*
- * Purpose: Returns the elapsed time in seconds since the last call to get_elapsed_time.
- */
- float get_elapsed_time() {
- static GLfloat old_time;
- GLfloat new_time, elapsed_time;
- if (old_time == 0) {
- old_time = glutGet(GLUT_ELAPSED_TIME);
- }
- new_time = glutGet(GLUT_ELAPSED_TIME);
- elapsed_time = (new_time - old_time) / 1000.0;
- old_time = new_time;
- return elapsed_time;
- }
Add Comment
Please, Sign In to add comment