Jump to content
  • Advertisement
Sign in to follow this  
nint22

OpenGL Forcing a glut rendering & Timing

This topic is 3578 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:

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


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
Advertisement
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 GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!