while(!done) // Loop That Runs While done=FALSE
{
if (PeekMessage(&msg,NULL,0,0,PM_REMOVE)) // Is There A Message Waiting?
{
if (msg.message==WM_QUIT) // Have We Received A Quit Message?
{
done=TRUE; // If So done=TRUE
}
else // If Not, Deal With Window Messages
{
TranslateMessage(&msg); // Translate The Message
DispatchMessage(&msg); // Dispatch The Message
}
}
else // If There Are No Messages
{
// Draw The Scene. Watch For ESC Key And Quit Messages From DrawGLScene()
if ((active && !DrawGLScene()) || keys[VK_ESCAPE]) // Active? Was There A Quit Received?
{
done=TRUE; // ESC or DrawGLScene Signalled A Quit
}
else // Not Time To Quit, Update Screen
{
SwapBuffers(hDC); // Swap Buffers (Double Buffering)
}
if (keys[VK_F1]) // Is F1 Being Pressed?
{
keys[VK_F1]=FALSE; // If So Make Key FALSE
KillGLWindow(); // Kill Our Current Window
fullscreen=!fullscreen; // Toggle Fullscreen / Windowed Mode
// Recreate Our OpenGL Window
if (!CreateGLWindow(/*"NeHe''s Texture Mapping Tutorial"*/"BIT|RAPE: Multiple Texture Loading",640,480,16,fullscreen))
{
return 0; // Quit If Window Was Not Created
}
}
}
}
Locking Framerate
I read a paper on how to do this a while back using TimeGetTime(), but i cant find it anywhere. been looking for the past hour :\
Anyway, what im trying to do is lock the framerate of my gl apps. basically what i think this invlolves is calling the Render() function if a certain timer interval has passed. im using the nehe gl basecode for my project, so heres the main loop:
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement