Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Two threads rendering to same window...

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

Hi, How can I solve the following problem: I create an OpenGL rendering window within a thread A and render a scene from that thread constantly (inside a loop). Inside of thread A I also handle messages for the rendering window (mouse movements, etc.). Now I have the possibility from another thread (thread B) to turn of the automatic rendering of thread A (thread A is still active, just the rendering is turned off) and to call from withing thread B the rendering routine. But... it doesn''t work! When I call the rendering routine from thread B, OpenGL commands are simply ignored. Do I have another rendering context from thread B? How can I simply and quickly fix this problem? Thanks

Share this post


Link to post
Share on other sites
Advertisement
I suppose you first deselect the context in thread A, then select it in thread B. Check return codes - are both these operations successful?

If the context selection call in thread B fails, or sometimes fails and sometimes not, you may have bug in thread synchronization - ensure that the context is really deselected from thread A when you are trying to select it from the thread B.

Hope this helps...

Have a nice day,


---
Never trust a Troglotroll.

Share this post


Link to post
Share on other sites
to select a context(in Windows):

wglMakeCurrent(hdc, hrc);

where hdc is windoze DC, hrc is your GL rendering context.

to deselect:

wglMakeCurrent(NULL, NULL);

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!