Jump to content
  • Advertisement
Sign in to follow this  

Windows message queue gets flooded when rendering

This topic is 566 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 encapsulated the the Windows API's CreateWindow around a class I call GLWindow, to which I render images using OpenGL. It took me some time, I even encapsulated the message queue, so basically my main function looks like that:

int main()
    GLWindow win;
    win.create("OpenGL Window", false, 1600, 800, -1, -1, true);

    init(); //initialize some opengl stuff

    bool quit = false;
    WindowEvent ev;

    while (!quit) {
        if (win.pollEvent(ev))
            if (ev.type == ev.WindowClosed || (ev.type == ev.KeyboardKeyPressed && ev.keyboardKey.key == Keyboard::Key::Escape))
                quit = true;



    return 0;
The render() function obviously takes the most time, and it causes the window procedure function to get flooded with messages, which eventually creates a delay in the WM_KEYDOWN and WM_MOUSEMOVE messages and because of that the camera update is delayed as well. (inside updateCamera())
Any idea what can I do?

Share this post

Link to post
Share on other sites

:lol:  :lol:  :lol:

Silly me. Thanks!


Don't feel too bad; I've seen a lot of people doing that who should definitely have known better.

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.

GameDev.net 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!