Jump to content
  • Advertisement
Sign in to follow this  
Pilpel

Windows message queue gets flooded when rendering

This topic is 412 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);
    win.hideCursor();
    win.moveMouseToCenter();

    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;
            else
                handleEvent(ev);
        }

        updateCamera(&win);

        render(&win);
    }

    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
Advertisement

: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.

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!