Skip to content

A fast 2D and 3D game engine — TypeScript SDK, C++/WebAssembly core, visual editor. Ship one project to web, desktop, WeChat MiniGames, playable ads, and native Android / iOS.

fix: add missing glBlendEquation to glad loader for Linux build

esenginef42839959ab9
diff --git a/src/esengine/renderer/OpenGLHeaders.hpp b/src/esengine/renderer/OpenGLHeaders.hpp
index 4a7b745d1..6d04f755f 100644
--- a/src/esengine/renderer/OpenGLHeaders.hpp
+++ b/src/esengine/renderer/OpenGLHeaders.hpp
@@ -29,6 +29,20 @@
#include <glad/glad.h>
#endif
+// GL blend equation constants/functions not present in all glad configurations
+#ifndef GL_FUNC_ADD
+ #define GL_FUNC_ADD 0x8006
+#endif
+#ifndef GL_MIN
+ #define GL_MIN 0x8007
+#endif
+#ifndef GL_MAX
+ #define GL_MAX 0x8008
+#endif
+#ifndef GL_BLEND_EQUATION
+ #define GL_BLEND_EQUATION 0x8009
+#endif
+
// GL constants not present in all headers / glad configurations
#ifndef GL_CONTEXT_LOST
#define GL_CONTEXT_LOST 0x0507
diff --git a/third_party/glad/include/glad/glad.h b/third_party/glad/include/glad/glad.h
index c9b7cb893..3a3dcbbf7 100644
--- a/third_party/glad/include/glad/glad.h
+++ b/third_party/glad/include/glad/glad.h
@@ -376,6 +376,8 @@ GLAPI PFNGLENABLEPROC glad_glEnable;
GLAPI PFNGLDISABLEPROC glad_glDisable;
GLAPI PFNGLBLENDFUNCPROC glad_glBlendFunc;
GLAPI PFNGLBLENDFUNCSEPARATEPROC glad_glBlendFuncSeparate;
+typedef void (APIENTRYP PFNGLBLENDEQUATIONPROC)(GLenum mode);
+GLAPI PFNGLBLENDEQUATIONPROC glad_glBlendEquation;
GLAPI PFNGLDEPTHFUNCPROC glad_glDepthFunc;
GLAPI PFNGLCULLFACEPROC glad_glCullFace;
GLAPI PFNGLFRONTFACEPROC glad_glFrontFace;
@@ -486,6 +488,7 @@ GLAPI PFNGLBLITFRAMEBUFFERPROC glad_glBlitFramebuffer;
#define glDisable glad_glDisable
#define glBlendFunc glad_glBlendFunc
#define glBlendFuncSeparate glad_glBlendFuncSeparate
+#define glBlendEquation glad_glBlendEquation
#define glDepthFunc glad_glDepthFunc
#define glCullFace glad_glCullFace
#define glFrontFace glad_glFrontFace
diff --git a/third_party/glad/src/glad.c b/third_party/glad/src/glad.c
index a5f68671c..de1eae34b 100644
--- a/third_party/glad/src/glad.c
+++ b/third_party/glad/src/glad.c
@@ -31,6 +31,7 @@ PFNGLENABLEPROC glad_glEnable = NULL;
PFNGLDISABLEPROC glad_glDisable = NULL;
PFNGLBLENDFUNCPROC glad_glBlendFunc = NULL;
PFNGLBLENDFUNCSEPARATEPROC glad_glBlendFuncSeparate = NULL;
+PFNGLBLENDEQUATIONPROC glad_glBlendEquation = NULL;
PFNGLDEPTHFUNCPROC glad_glDepthFunc = NULL;
PFNGLCULLFACEPROC glad_glCullFace = NULL;
PFNGLFRONTFACEPROC glad_glFrontFace = NULL;
@@ -152,6 +153,7 @@ int gladLoadGLLoader(GLADloadproc load) {
glad_glDisable = (PFNGLDISABLEPROC)load("glDisable");
glad_glBlendFunc = (PFNGLBLENDFUNCPROC)load("glBlendFunc");
glad_glBlendFuncSeparate = (PFNGLBLENDFUNCSEPARATEPROC)load("glBlendFuncSeparate");
+ glad_glBlendEquation = (PFNGLBLENDEQUATIONPROC)load("glBlendEquation");
glad_glDepthFunc = (PFNGLDEPTHFUNCPROC)load("glDepthFunc");
glad_glCullFace = (PFNGLCULLFACEPROC)load("glCullFace");
glad_glFrontFace = (PFNGLFRONTFACEPROC)load("glFrontFace");