// START Main run / update loop:
while(!quit)
{
StartTimer();
glutMainLoopEvent();
EndTimer();
Sleep(); // Sleep off an entire frame, or simply 1/30 th of a second
}
// END Main run / update loop
// START glut Display Callback
glClear(...);
/** Normal render code **/
glFlush();
glSwapBuffers();
// END of glut Display Callback
Forcing a glut rendering & Timing
Hello community,
I've finally ventured into the amazing library that is OpenGL (with openGlut as my utilities extension) and have been having a great time coding my project without all the issues I originally had with unmanaged DirectX (and win32 API in general).
The issue:
I realized today that my rendering function doesn't seem to call upon a window refresh; This simply means I have unable been able to refresh the window and present the appropriate buffer when needed. I know the content renders just fine in the backbuffer, and the window interacts appropriately (moves, resizes, etc..) The only special note I can write is that on every mouse click, the window will correctly render, but otherwise it won't do it usually.
The below is pseudocode for the general rendering and update functions.
As usual I appreciate any and all help! Thank you very much for any time spent on this.
If it is not redrawing on resize you can set a glut callback to a resize function which handles resizing (normally it would change the viewport size and reshape the viewing frustum to account for the change). You can then call your draw function from this callback and it should refresh the screen. You also don't need to call glFlush then glSwapBuffers as far as I know because the swapBuffers command flushes all the OpenGL calls anyway.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement