PDA

View Full Version : Share OpenGL context between two programs



JoshKlint
08-21-2010, 08:49 PM
Is there any way to launch another program and let it access the first program's OpenGL context? I would like to let an editor launch an external application and not have to reload the scene.

mfort
08-21-2010, 11:44 PM
Unfortunately it is not possible.
You have to send event to your OpenGL process to do what you need to do.

aqnuep
08-22-2010, 03:48 AM
You can do the following:
Create a new OpenGL context in your new program in a way that it is in the same share group as the original context.

This way you cannot draw to the original application's context but you can access the resources of it (like buffer objects and textures).

Maybe this is enough to make your use case working.

Suppose it is needed for the Leadwerks engine. Isn't it?

skynet
08-22-2010, 04:21 AM
You can do the following:
Create a new OpenGL context in your new program in a way that it is in the same share group as the original context.

No, you can't do that. As mfort already pointed out, sharing contexts across process boundaries is not possible.

aqnuep
08-22-2010, 04:58 AM
Okay, you're right, I realized that as well, however I still have some solution. It may sound kind of hackish but in fact is not that awful as it looks like:

1. Create the editor code inside a DLL.
2. Create a bootstap EXE for the editor.
3. The bootstrap sends a message to the engine process.
4. The engine process as a respond to this message will load the editor DLL and execute it's main function in a separate thread.
5. This thread executing the editor code now can create a context in the same share group thus can access the resources.

Please let me know if this possibility does fit your needs.

JoshKlint
08-25-2010, 08:52 AM
I knew it was impossible, but figured it was worth asking, just in case.

aqnuep
08-25-2010, 11:51 AM
Sorry for the off-topic question, but can you tell any inside information about what's going on about Leadwerks engine?

I'm very interested as even though I think Leadwerks is not the most well-optimized rendering engine out there, I see a lot of opportunities in it and I really like the way how you took advantage of deferred rendering and various other rendering techniques in it.

JoshKlint
08-25-2010, 11:10 PM
I actually started Leadwerks 3.0 last week. It's being written in pure C++, and intended for all platforms. I can't wait to get into the OpenGL 4 stuff in particular.

aqnuep
08-26-2010, 12:15 AM
Good news. If you have any problems or questions, especially related to OpenGL or some rendering techniques and you may think I can help, feel free to contact me. I would be pleased to help your project.

JoshKlint
08-26-2010, 03:39 PM
Cool, check your private messages on this forum.