Page 380 OpenGL Super Bible! Listing 10-9 is (Web site template)
Page 380 OpenGL Super Bible! Listing 10-9 is the WM_PAINT handler for our new program, SPINBOLT. Listing 10-9 WM_PAINT message handler for SPINBOLT // Storage for timing values static unsigned long ulStart = 0L; static unsigned long ulFinish = 0L; static double dTime = 0.0; // Storage for performance statistics char cBuffer[80]; RECT cRect; // The painting function. This message sent by Windows // whenever the screen needs updating. case WM_PAINT: { // Count how many times rendered static iRenderCount = 0; // Get time at beginning of spin if(iRenderCount == 0) ulStart = ulGetProfileTime(); // Call OpenGL drawing code RenderScene(); // Bring image to front SwapBuffers(hDC); // Increment count. If 71 or over get the finish time iRenderCount++; if(iRenderCount > 71) { iRenderCount = 0; ulFinish = ulGetProfileTime(); // Calculate the time in seconds dTime = ulFinish - ulStart; dTime /= 1000.0; } // Display time (be sure and set background colors) sprintf(cBuffer,”%3.1f Seconds for 360 degrees.”, dTime); GetClientRect(hWnd,&cRect);
Check Tomcat Web Hosting services for best quality webspace to host your web application.