Advertisement Jump to content
Sign in to follow this  

OpenGL Forcing a glut rendering & Timing

This topic is 3696 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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.

// START Main run / update loop:




     Sleep(); // Sleep off an entire frame, or simply 1/30 th of a second

// END Main run / update loop

// START glut Display Callback


/** Normal render code **/



// END of glut Display Callback

As usual I appreciate any and all help! Thank you very much for any time spent on this.

Share this post

Link to post
Share on other sites
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.

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!