开发者

OpenGL ES 2 - noob question regarding depth

开发者 https://www.devze.com 2023-03-14 07:22 出处:网络
okay i\'m kind of new to this 3D math and it was a major milestone was to get the projection &开发者_开发百科; modelview matrices right last night :]

okay i'm kind of new to this 3D math and it was a major milestone was to get the projection &开发者_开发百科; modelview matrices right last night :]

so i've got this simple model which renders correctly from this angle:

OpenGL ES 2 - noob question regarding depth

but when i rotate around the y axis, there's something wrong with the depth like this:

OpenGL ES 2 - noob question regarding depth

that might look interesting, but is not what i want currently. Basically the depth of these walls get mixed up?

can someone point me to the necessary steps on how to solve this? i need a depth buffer or something... right?


You should enable depth testing by calling

glEnable(GL_DEPTH_TEST);

And of course do not forget to clear your buffers by calling:

glClear( GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT);

I hope that this will help ;)

0

精彩评论

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