How can I increase distance (zfar/gluPerspective) where openGL stops drawing objects?

倾然丶 夕夏残阳落幕 提交于 2019-12-05 20:54:11

I figured out what was happening so I answer this myself to help other people in the future:

Changing zfar works ok. The problem I had was (not included in the question for simplification) was my skybox. Skybox was small and was hiding the objects with the sky. In pic2 is easy to see!

So if you have a similar problem just double check your skybox. If it were a zfar problem everthing should be black instead of having a sky texture!

The near and far values define the precision of the depth buffer. The higher the ratio between near and far is the more depth buffer precision errors you will get. Thus your depth buffer might actually allow to draw the objects but if they are small and close to each other they still might not be visible (rejected or be overdrawn).

If you increase from 3000.0f to 10000.0f it might still work. How big are your objects?

Why do you need that big viewing distance in the first place? Maybe there are other approaches that better fit your needs.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!