Problem with z-buffer

nikhilhs

Newcomer
Joined
Feb 22, 2004
Messages
22
I've used the following lines of code, and passed presentParams into the device constructor.

presentParams.Windowed = true;
presentParams.SwapEffect = SwapEffect.Discard;
presentParams.EnableAutoDepthStencil = true;
presentParams.AutoDepthStencilFormat = DepthFormat.D16;

However, this does not put the closest stuff in front. I think it's placing the ones that are rendered last in front. What am I doing wrong?

Thanks.

-Nick
 
I finally got it to work. Turns out the zNear was set to 0, and z-buffering only works if zNear is a positive value.
 
I have it on debug, but it didn't give me any warnings. Maybe I don't have the thing set up specifically. How do I do that?
 
nikhilhs said:
I have it on debug, but it didn't give me any warnings. Maybe I don't have the thing set up specifically. How do I do that?

If you installed the Debug Runtime then there will be a DirectX icon in the control panel. Run that and go to the Direct3D tab. Set the Debug Level to the second highest setting (The highest setting warns about a LOT of stuff so isn't recommended for regular use).

In Visual Studio go to the Project Settings and somewhere in there is a Enable Unmanaged Debugging (or something similar). Set that to true and the debug output will be routed to the Output window.
 
Back
Top