Sign in to follow this  

Porting DirectShow.NET from MDX to SlimDX

Recommended Posts

The source code to the ported sample : When I play a file I can only here the sound, the image isn't rendered correctly. Can someone see an error in my code? And yes, before anyone replies I have moved the Clear-invoke to after I invoke BeginScene on the device, I can only see black. Rendering is as follows : device.SetRenderTarget(0, renderTarget); device.BeginScene(); device.Clear(ClearFlags.Target, m_black, 1.0f, 0); Surface surface = Surface.FromPointer(lpPresInfo.lpSurf); Texture texture = surface.GetContainer<Texture>(); scene.Draw(texture, m_black); device.EndScene(); device.Present(); I have concluded that it's the following line that goes wrong. scene.Draw(texture, m_black); Why? Maybe someone here can tell me? Please email me, feel free to include modified project as attachment. ajden.towfeek [at sign] [Edited by - ajdto234 on December 20, 2008 5:12:25 PM]

Share this post

Link to post
Share on other sites
I've made some progress, the updated version is on the same url.

I can actually poll the first frame and display it now before it goes black, perhaps now someone can see the error?

Rendering :

device.SetRenderTarget(0, renderTarget);
using (Surface surface = Surface.FromPointer(lpPresInfo.lpSurf))
Texture texture = surface.GetContainer<Texture>();
scene.Draw(texture, Color.White);

Proof : :-)

Share this post

Link to post
Share on other sites
I've did some test on your code. It's seems that the problem lies in your rendering code.

I change the texture to load an image (not a good idea to do in the render loop, but just for the sack of debugging) using
Texture texture = Texture.FromFile(device, filePath);

Well, nothing is rendered. I still couldn't figure out the problem on the Sprite as I never used it before. I used 3D object all the time.

Maybe you can try to get it working by displaying some simple picture, then only load the texture from video.

If you intend to progress into 3D, do take a look at VMR9Allocator2. It's easier to fix than VMR9Allocator (for my case) :p

[Edited by - faulty on December 24, 2008 2:00:08 AM]

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this