Can I have two rendering contexts for one DC?

Hi to everyone,
in a program I’m writing in windows it would be nice if a second program could change the data of the display of the first one. Imagine writing a small open gl app which rotates a triangle. Can I write another program (a different executable) that will display, say a cube in the window of the first app?

I suppose I would need to know the handle to the Device Context for the first window. Can I associate two rendering context for the same device context?

Thanks in advance.

Hey,

I think you can. You just have to make sure you call wglMakeCurrent to associate the correct RC with a DC

You are calling for trouble.

You may do it though, but do not forget that a RC can not be current to 2 threads (nor programs).

If I had to do something like that, I would keep one thread drawing GL stuff and receving drawing commands, and several other threads or programs sending commands, with sockets or whatever.