Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

nes8bit

Z Buffer Problems

This topic is 6724 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

When I turn off the writing to the zbuffer and turn it back on, it doesn''t work. The zbuffer doesn''t go back to normal after that. Any suggestions? This happened on 3 computers so far. ------------------------ Captured Reality

Share this post


Link to post
Share on other sites
Advertisement
You should email nes8bit, he probably knows. Just kidding, is this OpenGL or Direct 3D??? Give some code that you are using.

---
www.crazycrackerz.org

Share this post


Link to post
Share on other sites
Direct3D

Not much to the code. It''s just setting the renderstate.

If UseZBuffer Then Direct3DDevice.SetRenderstate D3DRENDERSTATE_ZWRITEENABLE, True

''// Draw Particles Here

If UseZBuffer Then Direct3DDevice.SetRenderstate D3DRENDERSTATE_ZWRITEENABLE, False

------------------------
Captured Reality

Share this post


Link to post
Share on other sites
Does pd3dDev->Clear() return ok, or does it by chance give "no z-buffer present"? (And do the z-write render state changes return ok?) What do you mean the z-buff "doesn''t go back to normal"?

Share this post


Link to post
Share on other sites
I never looked into that.

After I set the renderstate to no writing to the zbuffer, it doesn''t want to go back. I''m wondering if I have to do something when I create the zbuffer surface or if it''s simply a driver problem. I will look into the zbuffer clears when I get back to my computer.

------------------------
Captured Reality

Share this post


Link to post
Share on other sites
Thanks guys for trying to help, but I found out it was a driver problem. I''m still not sure if its a driver problem, but I fixed it. If you ever get this problem, follow the pseudo code.

int i;

i = D3DDev.GetRenderstate(D3DRENDERSTATE_ZWRITEENABLE)
D3DDev.SetRenderstate(D3DRENDERSTATE_ZWRITEENABLE,False)

// Do particle effects here

D3DDev.SetRenderstate(D3DRENDERSTATE_ZWRITEENABLE,i)

it''s a very simple solution



------------------------
Captured Reality

Share this post


Link to post
Share on other sites
Uh, nes, that doesn''t look like a driver issue. It''s more of a logic one .

See this:

quote:

If UseZBuffer Then Direct3DDevice.SetRenderstate D3DRENDERSTATE_ZWRITEENABLE, True

''// Draw Particles Here

If UseZBuffer Then Direct3DDevice.SetRenderstate D3DRENDERSTATE_ZWRITEENABLE, False



Basically what your doing is turning on the Zwriting when you are drawing the particles, then turning it off as soon as your done. (You need to do the opposite )

So instead, do this:


If UseZBuffer Then Direct3DDevice.SetRenderstate D3DRENDERSTATE_ZWRITEENABLE, False

''// Draw Particles Here

If UseZBuffer Then Direct3DDevice.SetRenderstate D3DRENDERSTATE_ZWRITEENABLE, True


--TheGoop

Share this post


Link to post
Share on other sites

  • 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!