Fixing Bug Report [ 1160442 ] glutGet(GLUT_ELAPSED_TIME) is too granular
authorJohn F. Fay <johnffay@nettally.com>
Wed, 27 Apr 2005 16:02:31 +0000 (16:02 +0000)
committerJohn F. Fay <johnffay@nettally.com>
Wed, 27 Apr 2005 16:02:31 +0000 (16:02 +0000)
git-svn-id: svn+ssh://svn.code.sf.net/p/freeglut/code/trunk/freeglut/freeglut@585 7f0cb862-5218-0410-a997-914c9d46530a

src/freeglut_init.c

index 9cc6a72..89e4c43 100644 (file)
@@ -196,6 +196,9 @@ static void fghInitialize( const char* displayName )
         ReleaseDC( desktop, context );
     }
 
+    /* Set the timer granularity to 1 ms */
+    timeBeginPeriod ( 1 );
+
 #endif
 
     fgState.Initialised = GL_TRUE;
@@ -289,7 +292,6 @@ void fgDeinitialize( void )
         fgState.ProgramName = NULL;
     }
 
-
 #if TARGET_HOST_UNIX_X11
 
     /*
@@ -304,6 +306,11 @@ void fgDeinitialize( void )
      */
     XCloseDisplay( fgDisplay.Display );
 
+#elif TARGET_HOST_WIN32 || TARGET_HOST_WINCE
+
+    /* Reset the timer granularity */
+    timeEndPeriod ( 1 );
+
 #endif
 
     fgState.Initialised = GL_FALSE;