Archived

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

jmoses

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

Recommended Posts

jmoses    122
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
jmoses    122
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
oliii    2196
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
Sta7ic    139
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