From 979c226bdcd7904db5bd23dfbf526de4c040f436 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Sun, 21 Jan 2024 02:39:30 +0000 Subject: Look for and replace GL_XXX with fixed string --- gfx/gl/shader.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'gfx/gl/shader.cpp') diff --git a/gfx/gl/shader.cpp b/gfx/gl/shader.cpp index 285c2c3..b57dcd4 100644 --- a/gfx/gl/shader.cpp +++ b/gfx/gl/shader.cpp @@ -10,7 +10,16 @@ Shader::compile() const auto source = [&shader](auto text, GLint len) { glShaderSource(shader, 1, &text, &len); }; - source(text.data(), static_cast(text.length())); + if (lookups) { + std::basic_string textMod {text}; + for (const auto & match : ctre::range(textMod)) { + textMod.replace(match.begin(), match.end(), "255"); + } + source(textMod.c_str(), static_cast(textMod.length())); + } + else { + source(text.data(), static_cast(text.length())); + } glCompileShader(shader); CheckShaderError(shader, GL_COMPILE_STATUS, false, "Error compiling shader!"); -- cgit v1.2.3