Sign in to follow this  
ajdto234

Porting DirectShow.NET from MDX to SlimDX

Recommended Posts

ajdto234    122
The source code to the ported sample : http://ajden.towfeek.se/VMR9Allocator.zip 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] gmail.com [Edited by - ajdto234 on December 20, 2008 5:12:25 PM]

Share this post


Link to post
Share on other sites
ajdto234    122
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.BeginScene();
device.SetRenderTarget(0, renderTarget);
using (Surface surface = Surface.FromPointer(lpPresInfo.lpSurf))
{
Texture texture = surface.GetContainer<Texture>();
scene.Begin(SpriteFlags.None);
scene.Draw(texture, Color.White);
scene.End();
texture.Dispose();
}
device.EndScene();
device.Present();

Proof : http://ajden.towfeek.se/first_frame.jpg :-)

Share this post


Link to post
Share on other sites
faulty    115
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