summaryrefslogtreecommitdiff
path: root/src/client/shader.cpp
diff options
context:
space:
mode:
authorsfan5 <sfan5@live.de>2022-02-26 15:07:00 +0100
committersfan5 <sfan5@live.de>2022-03-09 22:37:34 +0100
commit51294163bbe39ca8b4a4620af724c9402f374142 (patch)
tree0f276bf3015b7e6e1e58acc05b53b31ed5532ef4 /src/client/shader.cpp
parent598efbf7f9d75307e7ea48ed7ec0e9b560e69375 (diff)
downloadminetest-51294163bbe39ca8b4a4620af724c9402f374142.tar.gz
minetest-51294163bbe39ca8b4a4620af724c9402f374142.tar.bz2
minetest-51294163bbe39ca8b4a4620af724c9402f374142.zip
Use Irrlicht bindings for GL call
Diffstat (limited to 'src/client/shader.cpp')
-rw-r--r--src/client/shader.cpp29
1 files 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 <GLES/gl.h>
-#else
-#include <GLES2/gl2.h>
-#endif
-#else
-#ifndef __APPLE__
-#include <GL/gl.h>
-#else
-#define GL_SILENCE_DEPRECATION
-#include <OpenGL/gl.h>
-#endif
-#endif
+#include <mt_opengl.h>
/*
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<const char*>(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";