View Full Version : rendering into OpenGL context from another process
02-19-2004, 02:36 AM
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!
02-19-2004, 07:32 AM
Do you mean another thread ... or indeed process?
02-19-2004, 07:33 AM
Indeed process, I'm afraid http://www.opengl.org/discussion_boards/ubb/smile.gif
02-19-2004, 07:43 AM
I don't think it's possible across process boundaries -- at least not directly.
02-19-2004, 10:17 PM
Hm, ok...any chance there's an "indirect" way?
02-20-2004, 07:37 AM
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.
03-01-2004, 11:21 PM
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.
03-03-2004, 12:10 AM
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!
Powered by vBulletin® Version 4.2.2 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.