Multiple DC, single RC

From all the informations I could gather on the subject it seems that it should be possible to share a RC on multiple DC (windows I suppose?) granted that all DCs use the same pixel format as the original DC used to create the RC.

Well, I’m using an ATI so I suspect the usual driver bug as it doesn’t work. What happens is that the original DC is still refreshed with no 3D whatsoever even if con’t use it at all (ie. no MakeCurrent to it) and the other DC (being set as current) just remain unmodified. Of course I’m not updating all DCs in parralel but sequentially.

Is wglMakeCurrent() supposed to work the way I think it should?

I need to have one GL engine shared along multiple windows. So I believe this exclude the multiple RC solution althought so far I’m just getting a nice application hang with it anyway…

If somebody has ever managed to do this I’d be happy to know how :wink: . However I repeat I do not want multiple RC, just one RC to multiple DC because I have a lot of resources loaded.


For multiple windows, I would suggest creating a unique context for each one, and call wglShareLists() to share resources (textures, etc.). If by “sharing your engine” you mean sharing resources, this will do the trick.

Thanks. The wglShareLists() tip allowed me to narrow down the problem to the use of the DOUBLE_BUFFER flag in my pixel format descriptor.

Basically the one RC multiple DC was already working but nothing would be displayed on the windows because of the DOUBLE_BUFFER flag. Now that would seem obvious that some kind of swap buffer function should be called when using this flag. However the one window code had been working perfectly on all kind of configurations forever with both double buffer and no swap buffer calls. Go figure…

So indeed, both solutions do work. One RC, multiple DC or multiple RC+DC with shared list. The one problem with the latter is that my initialisation render state are not moved across and since the first solution is now working my problem is solved! :wink:

Thanks a lot!

On ATI you can make use of the WGL_ARB_make_current_read extension. wglMakeContextCurrentARB() has very relaxed conditions on when two DC´s are compatible. But don´t expect it to work on nVidia the same way.

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.