Sharing Textures between multiple windows

I’m using a windows MDI app rendering OpenGL onto the MDI windows.

I want to share textures between the rendering contexts, and I think I can use wglShareLists with glBindTexture. Is this right?

What happens when the user closes the window that created the texture names, and is sharing the lists? Do I have to delete all of the texture names and then re-establish them and the sharing with a new window?

Thanks for any help

As far as I know wglShareList is only good for sharing DISPLAYlists between two contexts (but I’m not sure, never tried).
The shared display-lists are deleted when the last sharing context is deleted. Not before, so you don’t have to rebuild your lists until all windows are closed.

I read somewhere that bound textures could be shared using wglShareLists, I haven’t tried it either… yet, but if texture sharing was implemented it would make sense to use this methodology.

Thanks for the answer.

So just so I get it, once I share lists can I create lists in either context? Also does it matter which context shares the lists when I want another window to share them as well? In other words if window A shares with window B, when window A was closed can a new window just share the lists by using window B as the sharer?

Yes, you can share displaylists that way, but be careful: In your example the function MUST be called this way:
wglShareList(win_B_rc, new_win_rc);
Don’t swap the two parameters or your displaylists will be lost.

Just in case you’re interested, I tried this out and it worked like a charm for sharing textures between contexts.

Thanks for your help with the ShareLists thing.