|
|
|
|
| |
Video Texturing on the ATI Rage128
with Direct3D
|
The R128VidTex1 sample program illustrates the use of DirectShow to map a video clip onto a texture surface. The video can be in any valid DirectShow format such as AVI, MPEG or Quicktime. A texture surface is created to hold the incoming video stream that is generated using the DirectShow multimedia streaming interfaces. When updating the texture, the method IDirectDrawStreamSample::Update() is called to sample the video stream and update the video texture. Figure 1 shows R128VidTex1 in action.
|
|
Figure 1
|
|
- There are several items to be aware of when implementing video textures:
-
- Since the DirectShow interface IDirectDrawMediaStream only accepts IDirectDrawSurface types, a QueryInterface will be needed to convert texture surfaces that were created for texture interfaces (i.e., IDirectDrawSurface4) into a format suitable for DirectShow.
- Since the dimensions of the video stream may not match the restrictions on texture sizes, a surface at least as large as the video but which follows texture size restrictions will need to be created. For example, on a 320x240 video on a graphics chip with a power-of-2 restriction on texture size, a 512x256 surface would need to be created to accomodate the video.
- If the video does not fill up the entire texture surface, it is far more efficient to adjust texture u and v coordinates accordingly instead of stretching the video to the surface. Continuing the above example, to map the video texture fully onto an object, multiply the u coordinates by 320/512 and the v coordinates by 240/256.
- R128VidTex1 Controls
-
- F1 - Help
- F2 - Select Driver/Device/Mode
- [ALT]+[ENTER] - Toggle fullscreen/windowed
- [ESC] - Quit
Downloads
DirectX 6 project file, source, executable, and support files
|
| |
 |
|
|
|