0

I'm curious about working glDepthFunc. In my app I using it with GL_LEQUAL parameter. I'v read in documentation that this mean the pixel will be draw from the farest pixel to nearest. But when I for the first draw bitmap near to me and then I draw bitmap which is behind the first object, then its drawing good. Only problem is when the first bitmap is invisible. Then everything what is behind this bitmap is blank.

Bogus
  • 283
  • 1
  • 2
  • 13
  • "Only problem is when the first bitmap is invisible." - Do you mean the bitmap is transparent? The dept test can't help you with transparent objects. When you draw transparent objects, then you have to enable [Blending](https://www.khronos.org/opengl/wiki/Blending) and to draw the objects from the back to the front. – Rabbid76 Nov 04 '20 at 05:46
  • Do you have any idea how to store and sort objects by distance from camera? I mean sorting list of all drawable objects per frame looks like bad performance way. – Bogus Nov 04 '20 at 16:01
  • *"sorting list of all drawable objects per frame looks like bad performance way."* -Yes it is. However it is a common way. See further [Transparency Sorting](https://www.khronos.org/opengl/wiki/Transparency_Sorting) or [Transparency](http://www.opengl-tutorial.org/intermediate-tutorials/tutorial-10-transparency/). – Rabbid76 Nov 04 '20 at 16:24

0 Answers0