Jakob
Jakob

Reputation: 982

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:

enter image description here

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

enter image description here

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?

Upvotes: 3

Views: 615

Answers (1)

mrcomplicated
mrcomplicated

Reputation: 231

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

Upvotes: 1

Related Questions