For various reasons, I’d like to have a separate rendering process that renders into a window owned by another process (“output process”). I write the code for both processes myself. I’ve tried creating the window and GL context in the output process and sending over the HWND and HGLRC. I can call wglMakeCurrent in the rendering process without errors, but when I call SwapBuffers I get an “invalid handle” error. I’ve also tried to just send over the HWND to the rendering process and then to create the GL context from there, but SetPixelFormat fails with an “invalid handle” error. Is it at all possible to render into the window owned by another process? How should I do? Any ideas are greatly appreciated!
Do you mean another thread … or indeed process?
Indeed process, I’m afraid
I don’t think it’s possible across process boundaries – at least not directly.
Hm, ok…any chance there’s an “indirect” way?
The only thing I can think of is to use some sort of interface using RPC-like calls. One approach in the image generator world is to use CIGI (Common Image Generator Interface). You could take a simpler approach by using shared memory to interpret the type actions you want the renderer to take.
Hm…the actual interprocess communication is not a problem - I use .Net remoting for that part. The problem is how to use the GL context across process boundaries, or if it’s possible to have a GL context associated with a window handle in another process somehow.
Thanks to “Josh” from Australia who replied to this question at GameDev.net, I managed to accomplish what I want: I create a new process with its own top-level window, perform all OpenGL initialization there, and then call SetParent() to set this new window’s parent to a window within the first process. Works without a problem! Thanks Josh!
This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.