开发者

Shapes in OpenGL not properly set behind others

开发者 https://www.devze.com 2023-03-26 21:34 出处:网络
I am drawing a simple quad in OpenGL at \"altitude\" y=0.3, and after another quad below this one at altitude y=0 an开发者_StackOverflow社区d in another color.

I am drawing a simple quad in OpenGL at "altitude" y=0.3, and after another quad below this one at altitude y=0 an开发者_StackOverflow社区d in another color.

However when being above with the camera or turning around, the quad below appears above the higher one.

Is a 0.3 altitude too low for OpenGL or has this to do in the order they are drawn ? I have read that I could enable glEnable(DEPTH_TEST), but my Cocoa/Xcode environment does not know DEPTH_TEST. Thanks for your help !


You have read right. You dont have the z-buffer enabled. To do this, you need to do glEnable(GL_DEPTH_TEST).

documentation

0

精彩评论

暂无评论...
验证码 换一张
取 消