I figured since I am a beginner this question belongs here, although the subject matter is a little more advanced.
Basically what I wish to do is access the OpenGL output of a program under X and stream it out over a network in a form I choose. Basically what Yukon (http://www.neopsis.com/projects/yukon/) does, but with no audio and for a program with two OpenGL windows (only one of which I wish to copy).
The desired method would be to obtain the handle of the correct window - automatically or otherwise - and use this to access the buffer using GLX and then glReadPixels(). Since Yukon seems to do this by subsuming parts of the GL library am I correct in assuming this cannot be done? Or are they just being more clever than I need to be (this need only work in a very controlled environment for me)?
So the real questions here are:
- Will this method work & if so how (a rough outline will be enough to get me started - I can figure out specifics)?
- Can this be achieved any other way?
- Is this the wrong BB for such OS specific queries - if so can you point me in the right direction.
You are in a very controlled environment but you can’t recompile the program you want to video grab ? What program is it ?
I guess the best way to do it is to grab the Yukon sources, see how they do it, fiddle until you can grab the second window.
Operative question is whether you just want to relay the color buffer at some rate (what I’m assuming), or whether you want to reproduce the depth/multisample, and others as well, possibly with some sort of modification/playback of the GL event stream. Without more constraints, the former suggests maybe a simple xv/ksnapshot-style read the color buffer approach possibly with some simple real-time video compress, while the latter might suggest tapping into GLX stream ala Chromium.
For the former, I agree with ZbuffeR. If Yukon seems too tough, try ksnapshot, xv, or any one of a number of other sources to see how to grab the color buffer. As long as you have read access to the X display, you can pretty much do what you want.
(In all this, I’m assuming you don’t just want to run app on machine #1 and display on machine #2. That’s easy presuming similar X/GLX capabilities and app not presuming a direct rendering context.)
Would suggest follow-ups to the GLX forum, …but I see we don’t have one. So perhaps this is the best place.