Using live Video Feed for a texture in OpenGL

Does anyone here know anything about this topic - or know of any links to it - I have seen it running on an SGi a while back - and i am thinking about implementing it in a project.

I am aware that i would have to either resize the captured 320x240 image or use tex coords to select the area i want to make it power of two…

Would my GFDDR handle it - or be able to at best use it as an environment/reflection map?



Yes, this can certainly be done, but since you need to rebuild and upload the texture every frame, it is going to be very slow. The reason it runs well on an SGI is the shared memory architecture of SGI systems.

I did the exact thing you’re talking about a while back.I played an AVI as a texture on a polygon in OpenGL using the glTexSubimage2D()function to update the texture object with a new frame from the AVI.Get in touch with me if you need any source code.It actually runs really fast with me.I’ve got 4 quads playing the AVI at the same time on my GF2DDR and I’m getting like 92 frames/sec.

I’ve done this with FireWire cameras, and performance was absolutely no problem. The camera I used produced 1024x768 grayscale video at 15 fps, so 320x240 in true color shouldn’t be a problem either.

I’ll assume that you have an API that can stream the video into a memory buffer somewhere. What you should do is create a blank texture that’s large enough to hold your video. Then you can use glTexSubImage2D() to copy your video frames into this texture. Then just render a quad with the texture applied to it, and adjust your texture coordinates to prevent the empty parts of the texture from showing up.

  • Tom

Right, i see - I read a bit more about gltexsubimage2d and as far as i see it replaces the pixels for the currently loaded texure - so i could pass in the video data through this. Nice.

How far is it possible to go with extensions of this idea - ie: using it as a portion of a multitextured quad etc - or - as I am doing some pixel manipulation already with the video image to change its colours - would it be possible to make some of the Image transparent - i guess the data would be considered to be in .bmp format(?)


[This message has been edited by Auto (edited 03-12-2001).]