tags:

views:

20

answers:

0

How could I get Windows to tell me when a particular OpenGL rendering context is destroyed?

I am creating a small UI widget library that utilizes information stored in a single OpenGL rendering context per library context. To make the UI widget graphical resources available for other purposes, as well as to eliminate slow wglMakeCurrent calls, I have chosen to allow the implementer the choice of rendering context.

That is, it depends on which rendering context is active when a new UI context is requested from the library.

Although it is inconvenient, it is fairly straightforward to clean up the resources used by the library context through a "Cleanup" or "ReleaseResources" function.

I would prefer, however, to allow the system to clean itself up automatically when the rendering context is deleted as this significantly reduces coupling between the library and the program using it.

I have considered hooks, however I don't think they can provide the functionality I am looking for.

Any ideas?