From 7a967381681ba88f7a00864cbd118c87cdc1aa00 Mon Sep 17 00:00:00 2001 From: neuromancer Date: Tue, 4 Apr 2023 19:57:10 +0200 Subject: [PATCH] GRAPHICS: OPENGL: added another setUniform function to set an uniform value in shaders from an array of ints --- graphics/opengl/shader.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/graphics/opengl/shader.h b/graphics/opengl/shader.h index 16d908ec63d..185bd4fb063 100644 --- a/graphics/opengl/shader.h +++ b/graphics/opengl/shader.h @@ -131,6 +131,17 @@ public: } } + bool setUniform(const Common::String &uniform, const int size, const int *array) { + GLint pos = getUniformLocation(uniform); + if (pos != -1) { + use(); + GL_CALL(glUniform1iv(pos, size, array)); + return true; + } else { + return false; + } + } + // Different name to avoid overload ambiguity bool setUniform1f(const Common::String &uniform, float f) { GLint pos = getUniformLocation(uniform);