two RCs for one DC?

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?

Many thanks

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.

OK, Thanks Zengar.

Dummy window it is then!

Hang on…

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.

RC to DC binding has a one-to-one relationship. One RC can be current on only one DC and via versa :slight_smile:

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.

It is correct, yes. One RC per one DC per one thread :slight_smile: