Sign in to follow this  
arbitus

D3DImage and Managed DX stretching issue

Recommended Posts

Hey guys, sorry for crossposting this from the WPF MSDN, but I believe the issue is more DirectX related than WPF, but I wanted to try both places to get an answer. I have never performed non-backbuffer surface rendering in DX, which is probably the source of my problems. Anyway, here is the issue: Hey guys, I have an issue with D3DImage, but it covers both the WPF element and DirectX, so I hope someone can help, as I am not sure which portion is the problem. I have a rendering engine that renders a scene correctly. In one implementation, I have a Forms control hosted in WPF, and for the other, I am trying to use the D3DImage. Both implementations are using Managed DX. In the first implementation, whenever the control is resized, I resize the back buffer in the PresentParameters and then reset the device. Since the camera is an FOV perspective, both the camera aspect ratio and the back buffer get resized, and thus resizing the control increases the scene's size uniformly. In the D3DImage implementation, I am currently unable to reset the device, as I am finding it to be impossible to evict the surface from memory before reseting the device. I am thinking this might be my problem, but I cannot seem to be able to tell that surface to go away (it is being set as the RenderTarget a la the WPF D3DImage CodeProject example). Since I have to render with a depth buffer, I have to set the device backbuffer size that is greater than the surface or else I get an error. Just changing the size of the surface has no effect. Nothing I do prevents the image from rendering at the exact same size and just stretching it to fill the screen. So, simply resizing the surface does not help. I am going to have to assume I need to resize the Device back buffer as well? (As I mentioned previously, since I need to use a depth buffer, if I do not provide a size to the backbuffer parameters that is larger than the surface, I get an error... this is unlike all the samples I have seen which do not enable a depth buffer). Or am I off track completely? Also, as an aside, what is a quick and easy way to get the size of a control in pixels?

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