textures with multiple rendering contexts

Is it possible to share textures(texture objects) between rendering contexts, like you can with display lists? It’d be a shame to have to reload the texture each time I switch contexts.

Before you recommend using only one context, let me specify my situation. I have one doublebuffered context associated with teh window. The other is single buffered and associated with a memory device context(+DIB). Perhaps I can just use one context, but I’m not sure if it’s possible to use the same RC in both cases. Do rendering contexts store or factor in information concerning depth buffer bits, double buffering, etc, or is that all handled with the device context, and thus I can assocaite the RC with any device context.

Anyone? Help, as always, is appreciated.

J

Yes, textures, just like display lists, can be shared.

I believe wglShareLists is supposed to share both, although this may not be documented very well.

  • Matt

Based on what MSDN says, is this possible?

“Rendering contexts can share display lists only if they use the same implementation of OpenGL functions”

So if one context is doing software rendering and the other hardware, this won’t work, no?

“All rendering contexts of a shared display list must use an identical pixel format. Otherwise the results depend on the implementation of OpenGL used.”

Again, same issue. If one is in hardware and one software, they have different pixel formats. Am I reading this correctly?

J

Well, it’s impossible to share any OpenGL objects whatsoever between two separate OpenGL implementations. Our data structure for a texture or display list is unlikely to match the one used by any other vendor, and the same applies to all other vendors and all other implementations, so the only data structures that can ever be shared are those for contexts that use the same OpenGL implementation.

Now, I think the idea is that there is no guarantee that you can share objects between two contexts unless (1) they have the same pixel format and (2) they are using the same driver.

You will never be able to share an object between the MS OpenGL driver and any HW driver. It’s simply impossible.

However, if you used a pbuffer rather than a DIB, you could share objects between those.

  • Matt