Test whether two contexts are sharing lists/texes?

Is it possible to test whether two OpenGL contexts are currently sharing display lists and textures?

Ideally I’d like a cross-platform answer, but if either WGL or GLX offers such a query, I’d be interested to know.

Is it possible to test whether two OpenGL contexts are currently sharing display lists and textures?

No. Though I’m curious as to the circumstances that would require such a function.

Ideally I’d like a cross-platform answer

Contexts themselves are not cross-platform, so how would you expect this querying function to be?

I’m working on an “Image Buffer” hierarchy. The concrete class type could represent a Renderbuffer attached to an FBO, or an OpenGL-enabled window, or even a simple 2D array in memory. One of the things you can do with an ImageBuffer is copy its contents to another ImageBuffer, possibly of a different type, using the visitor pattern.

Now, copying an OffscreenOpenGLImageBuffer to a MemoryImageBuffer is easy; it’s just a glReadPixels with the appropriate bindings active.

But when copying one OffscreenOpenGLImageBuffer to another OffscreenOpenGLImageBuffer, for instance, different behavior is optimal depending on whether the two buffers use the same context or are capable of sharing resources. Since my OpenGLContext object is reference counted, testing whether they have the same one is easy; but I would prefer not to do a readback and then download if they have different, but compatible, contexts.

I suppose I may need to require texture sharing to be initiated through my interface so that I can just keep track of it myself.

[quote]Ideally I’d like a cross-platform answer

Contexts themselves are not cross-platform, so how would you expect this querying function to be? [/QUOTE]

Perhaps a cross-platform wrapper has already been developed which provides such a query, or perhaps methods for doing this on each major framework would be written with ifdefs.

The simplest method I’ve been using is to make a call to glGetTexLevelParameter within each context on a particular texture and comparing the results.

I could take this a step further and create a uniquely identifiable shareable just for the purpose of this test, but working from pre-existing textures has been sufficient for my purposes thus far.