Advertisement Jump to content
Sign in to follow this  

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

This topic is 3662 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hey, I'm poking around the wiimote headtracking project by Johnny Lee Chung (
here, or at the bottom 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?

Share this post

Link to post
Share on other sites
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,


Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!