Jump to content
  • Advertisement

Archived

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

jmoses

Bug: Weapon Drawn on HUD going through world...

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

Hello, I''m having a problem with the weapon on my Heads Up Display poking through the world, if I scoot it closer to the camera it happens less, but I like the way it looks where it is. I tried calling glClear( GL_DEPTH_BUFFER_BIT ); right before I draw the HUD (which is the last thing drawn in the game loop), but that didn''t fix it. I''m sure many people have ran into this problem before, how did you guys fix it?

Share this post


Link to post
Share on other sites
Advertisement
DrEvil, If I disable depth testing on the level, the polygons of the level will overlap all funny, if I disable depth testing with the gun model on the HUD, the weapon models polygons will become all glitchy looking. I''m pretty sure I need to just clear the Z buffer (the depth buffer), and Right before I draw the weapon model I do call glClear( CL_DEPTH_BUFFER_BIT ); but that doesnt work
Any Ideas?

Thanks,
- John

Share this post


Link to post
Share on other sites
clear the buffers (z buffer, color, stencil, whatever you have), enable z-test, render the scene, clear the z buffer (or try disable depth test), render the gun, disable z-test, render the HUD, swap buffers.

Share this post


Link to post
Share on other sites
Try this:
* Set the stencil op to output a 1 when drawing w/ no stencil test
* Draw your weapon model
* Swap the stencil test to skip pixels with a stencil 1
* Disable the stencil op
* Draw the world geometry

Good luck on yer project.
-"Sta7ic" Matt

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!