negative Z values


I’ve been making a 3-D render (from the scratch), and I’ve been having some trouble showing face with some negative-Z vetices.

for example, when you are in a room, the walls start behind you, but you can see then in your front.

with the standard projection formula (x/z , y/z), I get those vertices put in weird places.

Can someone help me?!


Apart from the projection from object space to screen space coordinates, you also have to set a near and far clipping plane for the vertices.

This is exactly what glFrustum does.