0

I have been messing around with OpenGL lately, and I noticed that the windows message pump is blocking whenever i attempt to resize my window, so as a result rendering is halted whenever i click on the menu bar or resize the window.

To fix this, I am looking into multithreading.

I have the following:

_beginthread(RenderEntryPoint, 0, 0);
while (!done)
{
 PeekMessage(&msg, NULL, NULL, NULL, PM_REMOVE);
 if (msg.message == WM_QUIT)
 {
 done = true;
 }
 else
 {
 TranslateMessage(&msg);
 DispatchMessage(&msg);
 }
}
void RenderEntryPoint(void *args)
{
 while (1)
 {
 //render code
 }
}

However, my scene isn't being rendered, and I'm not sure why.

asked Mar 23, 2012 at 3:34

1 Answer 1

5

You need to make the OpenGL rendering context current in the rendering thread, and make sure it's not current in the windowing thread. This also means that you can't call any OpenGL functions from the windowing thread.

answered Mar 23, 2012 at 3:38
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.