简体   繁体   中英

OpenGL ES 2 - noob question regarding depth

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:

在此输入图像描述

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

在此输入图像描述

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 ;)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM