isilrion Posted August 31, 2003 Posted August 31, 2003 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 Quote
Administrators PlausiblyDamp Posted August 31, 2003 Administrators Posted August 31, 2003 Are you using DirectX 9 or an earlier version? Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
isilrion Posted August 31, 2003 Author Posted August 31, 2003 DirectX version I forgot to say that, sorry. I'm using DirectX 9 and C#. Quote
Administrators PlausiblyDamp Posted August 31, 2003 Administrators Posted August 31, 2003 If you've installed the DirectX SDK you should find a sample in \Samples\VB.Net\AudioVideo\Texture which renders an avi to a to a surface. Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
isilrion Posted August 31, 2003 Author Posted August 31, 2003 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. Quote
Administrators PlausiblyDamp Posted August 31, 2003 Administrators Posted August 31, 2003 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. Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
isilrion Posted September 1, 2003 Author Posted September 1, 2003 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') Quote
Administrators PlausiblyDamp Posted September 1, 2003 Administrators Posted September 1, 2003 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 ;) Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
isilrion Posted September 1, 2003 Author Posted September 1, 2003 Please do. I'll really appreciate it. Thanks. Quote
Administrators PlausiblyDamp Posted September 2, 2003 Administrators Posted September 2, 2003 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) Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
Slade Posted September 18, 2003 Posted September 18, 2003 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 Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.