From c4da5c9867a946143dcd9b9ff4093c0d16faf0fe Mon Sep 17 00:00:00 2001 From: Hirek193 Date: Sat, 17 Oct 2026 02:16:58 +0200 Subject: [PATCH] Give the prefiltered environment map a texture unit of its own --- gl/shader.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/gl/shader.cpp b/gl/shader.cpp index 2fd20f9e..935f9598 100644 --- a/gl/shader.cpp +++ b/gl/shader.cpp @@ -275,6 +275,9 @@ void gl::program::init() glUniform1i(glGetUniformLocation(*this, "shadowmap"), gl::SHADOW_TEX); glUniform1i(glGetUniformLocation(*this, "envmap"), gl::ENV_TEX); glUniform1i(glGetUniformLocation(*this, "headlightmap"), gl::HEADLIGHT_TEX); + // the prefiltered environment map (envmapping.glsl); without a unit of its own the cube sampler would share unit 0 with + // the 2d diffuse texture of the materials, which makes their draws fail (GL_INVALID_OPERATION) + glUniform1i(glGetUniformLocation(*this, "envmap_ggx"), gl::ENV_GGX_TEX); GLuint index;