Possible to nest OpenGL inside OpenGL

I was wondering if anyone knew whether is is possible to have one OpenGL window inside another, that is two separate programs running?

I understand I will have to use multithreading so that one program doesn’t hog all the CPU time from the other. But not sure if you use child windows or something else??

I’d be grateful if someone could point me in the right direction

You mean have a parent window with a child window inside of it, each with their own rendering context? I’ve never tried it, and I suppose it is theoreticlly possible, but I don’t think you will find it very useful if it works. As I recall, most/all drivers don’t respect child window rects (the openGL parent window is content to draw right over the child window’s area), and the result you will get is both the parent window and the child window will be fighting to draw in the area of the child window.

The concept of windows is not a part of OpenGL. The window manager will take care of the clipping situation and OpenGL must only draw into the regions which are visible.
I don’t see why that shouldn’t work if you create the windows with the usual flags which are necessary for OpenGL rendering (WS_CLIPCHILDREN | WS_CLIPSIBLINGS are there for a reason).

I just tried it on my GeForce and it worked fine, but I am pretty sure there are some cards or drivers that don’t respect the child clipping area, though they might just be old cards, not sure. I think my Permedia might be one of them (it renders stright to the display, bypassing the windowing system).

Edit: Let me clarify. I tried putting a child window in my openGL window and it clipped just fine. I haven’t tried putting an opengl window in another opengl window.

[This message has been edited by LordKronos (edited 08-21-2002).]