Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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

Posted
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.
Posted

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')

  • Administrators
Posted

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 ;)

Posting Guidelines FAQ Post Formatting

 

Intellectuals solve problems; geniuses prevent them.

-- Albert Einstein

  • Administrators
Posted

Never got chance to even look at it yesterday :(

 

http://sunlightd.virtualave.net/Windows/DirectX.NET/DXTestVB.html

 

has a reasonably nice article on DirectX9 and about 1/2 way down shows how to do sprites using Direct3D.

 

I also had a problem with the MS texture sample - just pointed it to a different media file and it worked (probably missing a codec or something)

Posting Guidelines FAQ Post Formatting

 

Intellectuals solve problems; geniuses prevent them.

-- Albert Einstein

  • 3 weeks later...
Posted

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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...