Rendering video to DirectDraw surface

isilrion

Newcomer
Joined
Aug 30, 2003
Messages
20
Hi.

Is there any way to play a video into a DirectDraw surface? I'm trying to make a 2D animation on top of a .avi background. The AudioVideoPlayback class can (at least the documentation says) render the video to a Direct3D device, my guess is that if that can be done, then it must be possible to do it on 2D, but I have now idea how.

Any suggestion?

Isilrion
 
Yes, it renders the video using the .RenderToTexture method of the AudioVideoPlayback class. (I think that's the name of the method). The problem with it is that it renders it to a Direct3D device/surface/texture, wich I can't use/don't know how to use in DirectDraw.
 
Under DirectX 9 they've changed how things work, all drawing now uses Direct3D (even if you only require 2D).
Not sure how you would go about it just using the older DirectDraw interfaces.
 
That explains a few things, then.

I guess I'll have to forget about DirectDraw and begin playing with Direct3D.

The question changes a bit then.

Can I use Direct3D to do 2D animations? (2D text, 2D sprites over 2D video?) I mean, without creating a big cube 'looking' at the screen and drawing triangles on it. And if I can, how?

On top of everything, the AudioVideoPlayback\Texture sample won't run on my PC, throws an exception (that I can't copy right now, but the only *word* it has is 'exception')
 
You can use Direct£d for 2d stuff - you just create a 2d square and texture it with the 2d sprite (plus this gives you the benefit of hardware acceleration on newer cards).
I'll try and dig up a sample later, not near a PC with directX on at the moment - will knock up a sample later today if nobody beats me to it ;)
 
In regards to rendering to a d3d texture, I havent found anyone rendering more than just the texture containing the movie on the screen.

Since its an asynch call being made it really interferes with my rendering flow, along with the flow of every other setup I've seen. Even with thread/object locking I get flickering on the objects above the video and nothing below the video can be rendered without horrible results.

Has anyone come up with a good way to handle this?
The only 2 I can come up with is:

copying the texture to be rendered later (cant figure out how to do this in managed d3d but copying was really expensive in normal d3d)

rerendering the entire scene when the texture is ready
 
Back
Top