diff options
author | rsjtdrjgfuzkfg <public@rsjtdrjgfuzkfg.com> | 2023-02-16 23:53:43 +0100 |
---|---|---|
committer | rsjtdrjgfuzkfg <public@rsjtdrjgfuzkfg.com> | 2023-02-17 00:01:36 +0100 |
commit | 7f8fa79e9454a7b8769f9159810067141e17dbba (patch) | |
tree | d9bc4bb9eab4442bea6b5759ad03a1b78e831bd2 | |
parent | 29f670b7ab28d6393b0a61d6860decc69c2dc1ec (diff) |
OpenGL: fix culling without depth prepass
This commit ensures a known backface culling state when rendering, even
if no depth prepass is used. This fixes backside culling not being
applied properly in some situations, most notably in scenes that only
use backside culling on mobile platforms.
-rw-r--r-- | drivers/gles3/rasterizer_scene_gles3.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/gles3/rasterizer_scene_gles3.cpp b/drivers/gles3/rasterizer_scene_gles3.cpp index 1a18f35e64..6cc6b8224c 100644 --- a/drivers/gles3/rasterizer_scene_gles3.cpp +++ b/drivers/gles3/rasterizer_scene_gles3.cpp @@ -1895,6 +1895,10 @@ void RasterizerSceneGLES3::render_scene(const Ref<RenderSceneBuffers> &p_render_ glBindFramebuffer(GL_FRAMEBUFFER, rt->fbo); glViewport(0, 0, rb->width, rb->height); + glCullFace(GL_BACK); + glEnable(GL_CULL_FACE); + scene_state.cull_mode = GLES3::SceneShaderData::CULL_BACK; + // Do depth prepass if it's explicitly enabled bool use_depth_prepass = config->use_depth_prepass; @@ -1910,9 +1914,6 @@ void RasterizerSceneGLES3::render_scene(const Ref<RenderSceneBuffers> &p_render_ glEnable(GL_DEPTH_TEST); glDepthFunc(GL_LEQUAL); glDisable(GL_SCISSOR_TEST); - glCullFace(GL_BACK); - glEnable(GL_CULL_FACE); - scene_state.cull_mode = GLES3::SceneShaderData::CULL_BACK; glColorMask(0, 0, 0, 0); glClearDepth(1.0f); |