Why does openGL glDepthFunc () not work?

im playing with openGL and im trying to get rid of the blue marked triangles. I use this code for it:

glEnable(GL_DEPTH_TEST);
glDepthFunc(GL_LESS);
glEnable(GL_CULL_FACE);

And yes, I use

glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); 

in my main loop. I read that the problem can be a projection matrix. I use these values:

ProjectionMatrix = glm::perspective(45.5f, 4.0f / 3.0f, 0.1f, 100.0f);

I tried to change the near and far value, but still the same. I also tried changing the glDepthFunc parameter, but it also did not help me. So any ideas? Many thanks

my result

+4
source share
1 answer

, . - , glPolygonMode (...), .

, /. , (, ) , . , , , , .

, , , :

1

  • FILL
  • : glColorMask (GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE)

Pass 2

  • LINE
  • : glColorMask (GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE)

, () , ( , ). , , ( ) .

.. , (, GL_LEQAUL), . GL_LESS.

+7

All Articles