PDA

View Full Version : Sharing display list with more than one context



SandsofTime
10-19-2011, 08:30 PM
Hi
I am trying to share display lists of the main window with two secondary windows. I am able to do so using wglShareLists(). I was able to share the lists but the problem is that it only works for only one secondary window at a time. If I try to display list with the other window then the return value of wglShareLists() is false and the error returned by GetLastError() is a cryptic '3221684311'. I tried swapping the first secondary window with the second secondary window, but it wglShareLists() is successful only on the first call and fails on the second call. I have already made sure that that no context is acquired until the sharing is done.

remdul
10-24-2011, 12:35 AM
I assume the two windows are created within the same process? I'm not entirely sure, but that might be a requirement.

GetLastError is indeed useless for debugging this particular function, the MSDN page was changed a while ago and no longer helpful. I commented on this briefly at the end of this article:

http://www.bytehazard.com/code/sdlres.html

There is another requirement that requires the framebuffer pixel format of the two contexts to be the same. I'm not sure what the reasoning behind that was, but I've found that wglShareLists typically succeeds even if they differ (on NV hardware anyway). For example, if your main window has RGBA with depth buffer, and your child window RGB and no depth buffer, this could cause problems (according to the manual anyway). This would explain why the call fails on one child window and not the other (assuming they have differing pixel formats).