DirectX8 - Playing a Video in a Polygon

Started by
10 comments, last by Jim Adams 18 years, 9 months ago
How would I be able to play a video inside a polygon using DirectShow and DirectX8? Is it possible?
Advertisement
Yup it is possible. I remember that an SDK of version 8 had a sample where a video was played on a cylinder.
There was a sample in the SDK? I'll look in it now and see...
How's about a tutorial to play video in directx8? I can't find anything in the subject. Thanks.
There are many sites that show you how to play videos using DirectShow, like DirectX4VB for example. But what I'm looking for is something on playing videos inside a polygon. A tutorial on that would be nice to have. Google can't find squat on the internet regarding this subject. And I'm still digging the the source code of the Texture3D prog in the SDK, trying to find out what functions they used to do this. I hate playing this "Wheres Waldo" kinda game with myself, so any help would be appreciated. :)
It's dynamic texture maps i believe... Just copy the video bits to the textures surface and render it. I could be wrong though.
Never really worked with that before. Normally I just do what I always do when texturing polygons. Load my BMP file using CreateTextureFromFile, set some attributes, draw the polygons or polygonal objects, and vwola.
Quote:Original post by Daggett
It's dynamic texture maps i believe... Just copy the video bits to the textures surface and render it. I could be wrong though.


I believe you are right. I haven't dealt with video before actually but I'm pretty sure there is a method of gaining access to the raw frame data at a specific time interval. You'll have to create a blank texture using IDirect3DDevice9::CreateTexture with the correct size of the video. Once that is done I suspect that you gain access to the video frame pixels and lock you texture, fill it, then unlock it and use it like any other texture.
But since I'm using DirectShow and all to get the video going, what do I obtain from that to get the byte data I need?
I haven't done anything at all with DirectShow before, but here's a link with all of the interfaces for it (since I don't know what you're using): MSDN
Look for the something along the lines of locking and unlocking, as PumpkinPieman suggests.
If it is for Direct3D, you would create a texture of the same dimensions of the video (beware of padding), and get the texture's surface level using IDirect3DTexture8::GetSurfaceLevel(). From there you would proced to lock the surface, get the surface's data, fill it in with the data from DirectShow, unlock the surface, release the surface, and then apply the texture to a primitive. However, this would be somewhat slow...
Projects:> Thacmus - CMS (PHP 5, MySQL)Paused:> dgi> MegaMan X Crossfire

This topic is closed to new replies.

Advertisement