Jump to content
  • Advertisement
Sign in to follow this  
MrDoomMaster

IDirect3DDevice9::Clear()

This topic is 4841 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

The last two parameters of this function are very confusing to me. The second to last parameter is a value 0.0f - 1.0f. All I know is that a value of 1.0f clears the ZBuffer appropriately, while a value of 0 causes much distortion in objects. What does this range of values represent? MSDN fails to discuss this parameter in detail. The last parameter is a number controlling how the stencil buffer is cleared. I don't understand much about the stencil buffer in the first place, so if someone could explain the stencil buffer and also explain the last parameter in this function, I would greatly appreciate it. MSDN fails to discuss this parameter in detail. Thanks ahead of time guys!

Share this post


Link to post
Share on other sites
Advertisement
The values for the Z buffer represent the distance to the displayed "fragment" from the camera in "device" units. Setting the value to 1 means that anything you draw will be shown because it will be closer than the value in the Z buffer (since 1 is as far as you can get). Of course, after you have drawn something and you draw something behind it, it won't show because now the values in the Z buffer are closer than the thing you are drawing. If you set the values in the Z buffer to 0, nothing will be displayed because nothing will be closer than the values in the Z buffer (since 0 is as close as you can get).

Don't worry about the stencil buffer. If you don't use it, it can be ignored. The only thing is that clearing both the Z buffer and stencil buffer is generally faster than clearing just the Z buffer.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!