From 51294163bbe39ca8b4a4620af724c9402f374142 Mon Sep 17 00:00:00 2001 From: sfan5 Date: Sat, 26 Feb 2022 15:07:00 +0100 Subject: [PATCH] Use Irrlicht bindings for GL call --- src/client/shader.cpp | 29 +++++++++++------------------ 1 file changed, 11 insertions(+), 18 deletions(-) diff --git a/src/client/shader.cpp b/src/client/shader.cpp index dc9e9ae6d..fa5ffb914 100644 --- a/src/client/shader.cpp +++ b/src/client/shader.cpp @@ -40,20 +40,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "client/tile.h" #include "config.h" -#if ENABLE_GLES -#ifdef _IRR_COMPILE_WITH_OGLES1_ -#include -#else -#include -#endif -#else -#ifndef __APPLE__ -#include -#else -#define GL_SILENCE_DEPRECATION -#include -#endif -#endif +#include /* A cache from shader name to shader path @@ -667,13 +654,19 @@ ShaderInfo ShaderSource::generateShader(const std::string &name, )"; } + // Since this is the first time we're using the GL bindings be extra careful. + // This should be removed before 5.6.0 or similar. + if (!GL.GetString) { + errorstream << "OpenGL procedures were not loaded correctly, " + "please open a bug report with details about your platform/OS." << std::endl; + abort(); + } + bool use_discard = use_gles; -#ifdef __unix__ // For renderers that should use discard instead of GL_ALPHA_TEST - const char* gl_renderer = (const char*)glGetString(GL_RENDERER); - if (strstr(gl_renderer, "GC7000")) + const char *renderer = reinterpret_cast(GL.GetString(GL.RENDERER)); + if (strstr(renderer, "GC7000")) use_discard = true; -#endif if (use_discard) { if (shaderinfo.base_material == video::EMT_TRANSPARENT_ALPHA_CHANNEL) shaders_header << "#define USE_DISCARD 1\n";