In theory, this isn't too hard (well, at least the case of a camera in the
corner of the screen).

If you've heard of/used OpenCV or V4L API, you basically just grab a camera
frame each loop iteration (probably need to make sure the frame is a power
of 2 on each side, e.g. 256x256) and use glTexSubImage2D( ... ) to download
this to a texture. If you are just making an in-game feed (like a video in
the corner of the screen), then you can do a quick, hackish
glBegin(GL_QUADS) ... glEnd() to draw a small rectangle in a corner of the
screen with this texture (your camera image frame).

If you want to use a video as a texture (now we're getting tricky),  you'd
probably need some kind of special way to mark that a texture should be from
a camera/SWF input, maybe by checking if the texture filename ends in .swf
or some special camera texture e.g. "!camera". Rendering a SWF to an
off-screen surface to produce a frame of animation is way beyond the scope
of Quake III and probably would require a separate library, but assuming you
could, calling glTexSubImage2D( ... ) would once again be used.

You'd probably need to add code to the main loop to update any "video
textures", and if done properly, there shouldn't be much to change on the
actual rendering. A pitfall is that many camera directly capture to JPEG
image or non-RGB formats, making them unsuitable for textures -- I think
OpenCV provides a way to get RGB/BGR data from this, otherwise, you'll have
to write some colorspace conversions (YUV->RGB) or use the libjpeg.

I hope this is a starting point for you and good luck.

Patrick

On Wed, Mar 31, 2010 at 11:37 AM, Thys <recyclero...@gmail.com> wrote:

> Hello!
>
> I'm a interaction student from belgium and currently working on a Quake3
> project, I've setup a linux box that sends out messages to Max/MSP (or
> PureData) from ingame Quake, now I want to try to add a live webcam stream
> INGAME, so some kind of dynamic texture or just a swf or something, after 3
> days of sleepless nights I'm really desperate, anyone any idea?
>
> Any help is greatly appreciated!!
>
> Greetings, Thys
>
> _______________________________________________
> ioquake3 mailing list
> ioquake3@lists.ioquake.org
> http://lists.ioquake.org/listinfo.cgi/ioquake3-ioquake.org
> By sending this message I agree to love ioquake3 and libsdl.
>
_______________________________________________
ioquake3 mailing list
ioquake3@lists.ioquake.org
http://lists.ioquake.org/listinfo.cgi/ioquake3-ioquake.org
By sending this message I agree to love ioquake3 and libsdl.

Reply via email to