OpenGL "overlay"

I’m trying to develop a simple opengl display that I can use inside of a developing product of mine. The product is a window-based plugin, for use inside of a well-known animation package. Whilst their sdk does have ogl in it, I’ve been told by support services that I won’t get support for it because it’s not meant for 3rd parties (despite having headers available to ‘use’, and paying the several thousands of dollars to have it in the first place).

In an effort to try and find a solution, I’m wondering if it’s possible to hijack the window handle (their sdk provides a void* reference) or overlay another window on top of the existing one, where the ogl draw can be done. Is there anyone whose done anything like this before? Can glew help here? FLTK? Something else perhaps?

After all the work I’ve put into developing this product, the time, and money, I’m left feeling quite disheartened at the lack of support from their end. So any assistance here would be greatly appreciated. Hacks and all. Cheers,


P.s. my apologies if a similar message appears twice - I’m having one of those days.

In general, trying to share a resource (such as a window) without cooperation from other code which uses it tends to be problematic.

If you can get the window handle, you can create a context for it and use that to render. But you need to ensure that any previous context is restored before returning control to the application. And there may be other factors involved; e.g. anything that’s a property of the window itself rather than context state will be beyond your control. If you need to use additional libraries, those probably won’t like being initialised more than once, yet you may not be able to use them without information (e.g. handles) returned during initialisation.

Thanks GClements, I’ve had a closer look at their sdk, and I can see that we can create and delete a context via their api. Their creator looks like this:

typedef void *CreateContext(void* context, void* root, ULONG flags);

But when using it in code, it wants us to do this:


The ogl_id object appears to be some int-like number, maybe a context id. But you don’t declare it anywhere, you just give the CreateContext(…) an undeclared variable and this variable is usable in the code’s scope. I must admit, I haven’t seen anything like this before, normally I would declare it first - “int ogl_id;” - but apparently we don’t do that with the above?

Where does something like this leave me? Is grabbing the current context, then swapping to mine, and back to the initial one doable with standard opengl?


Context management is outside the scope of OpenGL. You need to use the platform’s APIs (e.g. wgl* functions for Windows).