Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3300502
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T20:40:07+00:00 2026-05-17T20:40:07+00:00

NOTE: Please read the whole thing before posting, you’ll see why. So I have

  • 0

NOTE: Please read the whole thing before posting, you’ll see why.

So I have an OpenGL/WinAPI application. I’m doing what you would expect, by doing cycles of handling messages, then rendering a frame, handling messages, rendering frame…

The trouble is, when I resize or move a window, the screen freezes, and it can look quite ugly. I know from previous expirements with OpenGL that limiting the number of messages to be processed between frames (either by number or time) does the trick. It seems windows is blocking my app whenever it moves/resizes the window. From expirimenting, I do know that putting the windows message handling into another thread and forgetting about it works quite well, and helps with the timing aswell.

My question is: Is there any better, less destructive, or non-threaded way of doing this? Is there any downside to what I am doing (besides the multithreading dramas). I would love to know if multithreading is avoidable.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T20:40:07+00:00Added an answer on May 17, 2026 at 8:40 pm

    When the user clicks on the non client areas of a window to move or size a window, DefwindowProc goes into a modal loop, so your game loop is no longer being executed – until the user cancels or finishes the modal operation.

    There are window messages you can use to detect the start and end of modal operations: WM_ENTERSIZEMOVE for example.

    The crux of the matter is, if your OpenGL window is not fullscreen, or it displays message boxes, then you cannot rely on a simple game loop to keep on rendering the game – you need to switch to a timer based renderer.

    SetTimer can create a timer that will deliver WM_TIMER messages even when modal operations are in progress.

    PS. A note on threading: OpenGL contexts are not thread safe and accessed must be serialized (manually by user code) if a context is shared across threads. Even if multiple contexts are used, access to the actual device is serialized too, so there is no performance benefit to be gained from multithreading an OpenGL based renderer – unless (ironically) you do a lot of CPU intensive work (and then something like OpenMP to parallelize loops would help there more than trying to design a higher level multi threaded rendering job dispatcher). Basically: stick to a single threaded renderer with OpenGL – it will perform better than almost any attempt at threading, and be far more predictable to.

    PPS. For windowed OpenGL apps its probably also be better to abandon the traditional game-loop approach to rendering each frame, and rely on the RedrawWindow to dispatch WM_PAINT messages to the window: Painting inside a BeginPaint/EndPaint block means your applications rendering behaviour is much more predictable, and the DesktopWindowManager process can deal with its job of applying aero glass effects, and trying to implement vsync’ed updates of the desktop to the display much more efficiently.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Before reading please note that I've googled this and read a ton of articles
Please note this application will never be running on a server system. I am
(Please note that I have seen a similar question on StackOverflow recently, however I
Please note that this is not homework and i did search before starting this
Please note - I am not looking for the right way to open/read a
Note: This might seem like a Super User question at first, but please read
Please note that I'm not asking how but why. And I don't know if
[Please note that this is a different question from the already answered How to
Please note: This is a question about the Eclipse plugin Subversive , and not
Please note this is not a question about online/hosted SVN services. I am working

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.