Drawing player gun without depth test

Started by
2 comments, last by Revelation60 16 years, 6 months ago
Hi, For my shooter the player must have a gun. This gun should always be visible, so if I stand close to a wall, it must not get through the wall. So I thought, I'll disable the depth test, but that causes the gun to get rendered incorrectly (every part get's drawn upon eachother). How can I fix this?
Currently working on WalledIn
Advertisement
Quote:Original post by Revelation60
Hi,

For my shooter the player must have a gun. This gun should always be visible, so if I stand close to a wall, it must not get through the wall. So I thought, I'll disable the depth test, but that causes the gun to get rendered incorrectly (every part get's drawn upon eachother).

How can I fix this?
You can simply render it last with the depth test enabled but with clearing the depth buffer before you render it.
glDepthRange(0,0.001);
draw gun
glDepthRange(0,1);
Thank you both :)
Currently working on WalledIn

This topic is closed to new replies.

Advertisement