View Full Version : two RCs for one DC?
11-17-2007, 09:11 AM
Can I use wglCreateContext twice on the same DC to create two seperate render contexts?
What I want to do is use one context to render to (in one thread) an use the other RC simply as a shared context in another thread (basically to upload textures in the background, which will be shared across multiple windows).
Or is it best to just create a hidden window and share the RC from there?
11-17-2007, 12:05 PM
You can create multiple RCs using the same DC,but you can only bind one RC to a DC at the same time. A RC can be bound to any windows, not only the one that was used to create it - the only restriction is - they must have the same pixelformat.
11-17-2007, 12:38 PM
OK, Thanks Zengar.
Dummy window it is then!
11-17-2007, 12:50 PM
If I understand correctly, I only need to wglCreateContext on ONE window, and then just make it current to any other window (assuming the same pixel format)?
I'm making a multimonitor app with several top level (maybe fullscreen) windows. Each will use the same pixel format. So presumably using just one RC will save some system resources (?). BTW I'm using just one thread to render to each window serially.
11-18-2007, 04:03 PM
RC to DC binding has a one-to-one relationship. One RC can be current on only one DC and via versa :)
11-19-2007, 01:15 AM
You can create multiple RCs using the same DC,but you can only bind one RC to a DC at the same time.
You can create multiple RCs using the same DC, but you can only bind one RC per thread to a DC at the same time.
Read the wglMakeCurrent manual, it explains all these issues.
11-19-2007, 01:40 AM
It is correct, yes. One RC per one DC per one thread :)
Powered by vBulletin® Version 4.2.3 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.