Skip to content

A fast 2D and 3D game engine — TypeScript SDK, C++/WebAssembly core, visual editor. Ship one project to web, desktop, WeChat MiniGames, playable ads, and native Android / iOS.

chore(rhi): GL states the depth function its second backend states

yhh09af41f0fd25
diff --git a/src/esengine/renderer/rhi/GLDevice.cpp b/src/esengine/renderer/rhi/GLDevice.cpp
index eb80b9a09..17e8e5808 100644
--- a/src/esengine/renderer/rhi/GLDevice.cpp
+++ b/src/esengine/renderer/rhi/GLDevice.cpp
@@ -256,6 +256,9 @@ std::string readProgramInfoLog(GLuint program) {
void GLDevice::init() {
glEnable(GL_DEPTH_TEST);
+ // GL's own default, stated because the second backend states it too: a rule
+ // one backend declares and the other inherits can drift with neither saying so.
+ glDepthFunc(GL_LESS);
glEnable(GL_BLEND);
glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
captureDeviceIdentity();