DEPTHBUFFER is mainly used in a 3D scene, and when rendering, the problem occurs between objects and objects, such as an object A in front of the other object B, will not see the portion of the object B is blocked when it is rendered. Of course, the 3D scene is not just the problem of moving before and after, and all sides are possible.
1. Initialize the device: presentParams.EnableAutoDepthStencil = true; presentParams.AutoDepthStencilFormat = DepthFormat.D16; 2 when rendered:. Device.Clear (ClearFlags.Target | ClearFlags.ZBuffer, System.Drawing.Color.Blue, 1.0f, 0) Adding a ClearFlags.zbuffer, first "Clear"
Get it (of course, this is just a simple use of depthbuffer!) Using Lights: First, the vertices must be Normal, ie, you must set the normal.
1. Then Device.Renderstate.lighting is set to True (default) .2. Set each element property of the Device.lights array. 3. Do not forget the .Nabled attribute in the call element.