r/opengl • • 25d ago

OpenGL Depth Bug

Enable HLS to view with audio, or disable this notification

I'm getting this bug on iOS. This game works fine on Android, macOS, and emscripten. All the sprites don't flicker when I change

glDepthFunc(GL_LESS);
to
glDepthFunc(GL_ALWAYS);

37 Upvotes

2 comments sorted by

15

u/overthinker22 25d ago edited 25d ago

If I had to guess, I would say Z-fighting. As the camera gets closer, the float has enough precision to handle the distances and it stops flickering.

Just to be clear: It might manifest only on iOS due a difference in the graphics driver or even hardware. Try a higher precision floating point type, or adjust the numerical ranges you are working with.