SuperDisk
SuperDisk

Reputation: 2840

OpenGL Depth Buffer

I am a complete novice to OpenGL, so I am just trying out some tests with it. I have a rectangle that I can rotate and translate around, and all is well.

The problem is, when I translate it below 1.0 Z, it disappears! I read about the depth buffer, and it says that its depth shouldn't be touched. Is there a way to work around this that I am completely missing? (Probably) If so, what is it?

Upvotes: 1

Views: 321

Answers (1)

Reed Copsey
Reed Copsey

Reputation: 564413

This is likely due to an incorrect projection matrix. When you setup your projection matrix, you need to specify the clipping planes (zNear and zFar) - anything outside of these will get "clipped away" and not show up.

For details, see gluPerspective.

Upvotes: 4

Related Questions