Video via RenderToTexture on the Wiimote Headtracking project by Johnny Lee Chung

Started by
0 comments, last by BrakePad 15 years, 3 months ago
Hey, I'm poking around the wiimote headtracking project by Johnny Lee Chung (
here, or at the bottom http://www.cs.cmu.edu/~johnny/projects/wii/ here.), it's real impressive. It's in C# on DirectX, and it has this feature where it displays a picture onto a texture instead of just a grid with targets in space, and you can go closer and further away from the picture, and sort of look to the left and the right in it. Now it basically just loads a png texture from file like this: backgroundtexture = TextureLoader.FromFile(device, backgroundFilename); using the TextureLoader class in Microsoft.DirectX.Direct3D. Now what I want to do is display a video instead, that works in the same way. I found out I need to use the Video.RenderToTexture method to render the video onto a texture, but I'm having trouble finding concrete examples of people who have done this simply in a way that demonstrates the principles of how to implement it. Do you know anywhere I can find some tutorials that explain how this RenderToTexture method works?
Advertisement
A google search for "Video.RenderToTexture" will return several hundred results with any of the following words in: "error, problem, bug, memory leak..."

In my experience trying to trick the AudioVideoPlayback classes to do what I want, particularly rendering video to texture, you'll probably spend weeks trying to figure out why it isn't working, then stumble across a thread somewhere that explains there is a bug in the render to texture function that prevents resources from being disposed of - quite a severe memory leak when you're dealing with video!

Anyway, I would recommend looking into the DirectShowLib libraries - there's a helpful sample available for download called "VMR9Allocator" (and "VMR9Allocator2" if you're using your own render loop) which will do precisely what you want it to. You can get the samples here

Hope this helps,

bp

This topic is closed to new replies.

Advertisement