View Full Version : the sample of using Video As Texture

06-18-2003, 08:15 AM
Is there any sample on the web or a bit of source code of

using video as texture? I want basically the 'Video (LIVE)

coming from a source (like USB Webcam/Other Capture

Device) to be loaded as a Texture. Will appreciate any

type of help in this regard.

lost hope
06-18-2003, 11:40 AM
i'm currently working on a project that uses captured video camera input as textures. to actually capture the image i'm using the cvcam code in intel's computer vision library. if you want to check it out (openCV), here's the address: http://sourceforge.net/projects/opencvlibrary they provide a simple example that shows how to capture the image to an array. at that point, you can just build an opengl texture as usual.

[This message has been edited by lost hope (edited 06-18-2003).]

[This message has been edited by lost hope (edited 06-18-2003).]

06-18-2003, 11:17 PM
I think nehe has a tutorial on using an avi as a texture...

06-19-2003, 10:16 AM
I had written such a program using DirecShow(for video capturing)and "glTexImage2D", "glTexSubImage2D" functions,but I found the "glTexSubImage2D" can damage the performance of system,it will consume extra 150MHz of my 1.5G P4 CPU.I am not sure it is the problem of "glTexSubImage2D" or my computer(1.5G P4+768M SDRAM+Geforce Ti4200),but I found a similar sample in DirectX SDK and it will not consume any extra resource of CPU.I don't how to use DirectX,so please give me some sample code or doc,so I can rewrite my program to improve performance.

06-19-2003, 06:31 PM
Did the Dx demo use the video input as a texture? I only remember having seen a video capture demo in the Dx SDK - it probably just uses GDI based functions to display the data - which is quite a bit different to if it used that data as a texture.

Are you trying to put the video feed onto an 3D object? Or are you simply trying to display it? glTexSubImage2D is going to be your best bet (unless some extensions out there can speed this process up).

For performance issues I would suggest you read jwatte's post in the following thread.


06-21-2003, 04:23 AM
the DX demo using the video input as texture,and the implement way is similar with my app,but it use lower CPU usage than my app.The CPU usage is costful for my app,so I'm still finding a way of reducing the CPU usage.