Skip to main content
added 184 characters in body
Source Link
kaoD
  • 1.9k
  • 15
  • 17

Did you miss glEnable(GL_DEPTH_TEST)? I don't see it anywhere in your code (although I'm aware you didn't post it all, it might be somewhere else.)

Also, both zNear and zFar MUST BE positive in perspective projection (not sure about orthogonal.) Actually, it doesn't make sense (at least syntactically) to have the planes reversed. Bear in mind that even if OpenGL looks towards the negative Z axis, z-planes are positioned relative to the viewpoint (positive being forwards from it.)

I'd be glad if someone posted a use case where negative planes are useful, and even more glad if it made sense to have the planes reversed (zFar being behind the viewer as you do.)

Did you miss glEnable(GL_DEPTH_TEST)? I don't see it anywhere in your code (although I'm aware you didn't post it all, it might be somewhere else.)

Also, both zNear and zFar MUST BE positive in perspective projection (not sure about orthogonal.) Actually, it doesn't make sense (at least syntactically) to have the planes reversed. Bear in mind that even if OpenGL looks towards the negative Z axis, z-planes are positioned relative to the viewpoint (positive being forwards from it.)

Did you miss glEnable(GL_DEPTH_TEST)? I don't see it anywhere in your code (although I'm aware you didn't post it all, it might be somewhere else.)

Also, both zNear and zFar MUST BE positive in perspective projection (not sure about orthogonal.) Actually, it doesn't make sense (at least syntactically) to have the planes reversed. Bear in mind that even if OpenGL looks towards the negative Z axis, z-planes are positioned relative to the viewpoint (positive being forwards from it.)

I'd be glad if someone posted a use case where negative planes are useful, and even more glad if it made sense to have the planes reversed (zFar being behind the viewer as you do.)

added some information
Source Link
kaoD
  • 1.9k
  • 15
  • 17

Did you miss glEnable(GL_DEPTH_TEST)? I don't see it anywhere in your code (although I'm aware you didn't post it all, it might be somewhere else.)

Also, both zNear and zFar MUST BE positive in perspective projection (not sure about orthogonal. Either way) Actually, it doesn't make sense (at least syntactically) to have the planes reversed. Bear in mind that even if zFar is nearer than zNear as their names implyOpenGL looks towards the negative Z axis, z-planes are positioned relative to the viewpoint (positive being forwards from it.)

Did you miss glEnable(GL_DEPTH_TEST)? I don't see it anywhere in your code (although I'm aware you didn't post it all, it might be somewhere else.)

Also, both zNear and zFar MUST BE positive. Either way, it doesn't make sense if zFar is nearer than zNear as their names imply.

Did you miss glEnable(GL_DEPTH_TEST)? I don't see it anywhere in your code (although I'm aware you didn't post it all, it might be somewhere else.)

Also, both zNear and zFar MUST BE positive in perspective projection (not sure about orthogonal.) Actually, it doesn't make sense (at least syntactically) to have the planes reversed. Bear in mind that even if OpenGL looks towards the negative Z axis, z-planes are positioned relative to the viewpoint (positive being forwards from it.)

Source Link
kaoD
  • 1.9k
  • 15
  • 17

Did you miss glEnable(GL_DEPTH_TEST)? I don't see it anywhere in your code (although I'm aware you didn't post it all, it might be somewhere else.)

Also, both zNear and zFar MUST BE positive. Either way, it doesn't make sense if zFar is nearer than zNear as their names imply.