Jump to content
  • Advertisement
Sign in to follow this  
gapet

Rendering during window move or resize

This topic is 4410 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

I use common Windows message loop, something like this :
for (;;)
{
  if(PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) {
    if (msg.message == WM_QUIT) break;
    TranslateMessage(&msg);
    DispatchMessage(&msg);
  }
  RenderFrame();
  SwapBuffers();
}

I want the rendering to continue even when moving or resizing the window, but the problem is that PeekMessage() does not return until the moving or resizing is finished. What is correct solution ? I tried to call RenderFrame() when processing WM_MOVE and WM_SIZE but it not a solution because it works only when really moving the mouse. Thanks, Petr

Share this post


Link to post
Share on other sites
Advertisement
Yes, I tried this. But the results are the same like calling RenderFrame() directly from WM_SIZE, because WM_PAINT message is posted only when the the mouse is moving during the resize and the framerate depends on how fast it is moving.

Share this post


Link to post
Share on other sites
You can create a separate thread for your rendering loop, and do normal window message handling with GetMessage(). But take note that your messages can be processed at any point in your rendering loop like this..
Just curious, why do you want to do this anyway?

Share this post


Link to post
Share on other sites
Separate thread may work, but will require more changes in the design. I tried simpler solution. At the beginning of move or resize I start a timer and then do the rendering in WM_TIMER. It is not perfect but it works. Maybe it is not that necessary but I only wanted the option to continue rendering at all cases even during move or resize.

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!