diff options
Diffstat (limited to 'src/SFML/Graphics/GLExtensions.cpp')
-rw-r--r-- | src/SFML/Graphics/GLExtensions.cpp | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/src/SFML/Graphics/GLExtensions.cpp b/src/SFML/Graphics/GLExtensions.cpp index fff712d..35e59ec 100644 --- a/src/SFML/Graphics/GLExtensions.cpp +++ b/src/SFML/Graphics/GLExtensions.cpp @@ -1,7 +1,7 @@ //////////////////////////////////////////////////////////// // // SFML - Simple and Fast Multimedia Library -// Copyright (C) 2007-2018 Laurent Gomila (laurent@sfml-dev.org) +// Copyright (C) 2007-2023 Laurent Gomila (laurent@sfml-dev.org) // // This software is provided 'as-is', without any express or implied warranty. // In no event will the authors be held liable for any damages arising from the use of this software. @@ -29,6 +29,14 @@ #include <SFML/Window/Context.hpp> #include <SFML/System/Err.hpp> +// We check for this definition in order to avoid multiple definitions of GLAD +// entities during unity builds of SFML. +#ifndef SF_GLAD_GL_IMPLEMENTATION_INCLUDED +#define SF_GLAD_GL_IMPLEMENTATION_INCLUDED +#define SF_GLAD_GL_IMPLEMENTATION +#include <glad/gl.h> +#endif + #if !defined(GL_MAJOR_VERSION) #define GL_MAJOR_VERSION 0x821B #endif @@ -45,13 +53,16 @@ namespace priv //////////////////////////////////////////////////////////// void ensureExtensionsInit() { -#if !defined(SFML_OPENGL_ES) static bool initialized = false; if (!initialized) { initialized = true; - sfogl_LoadFunctions(); +#ifdef SFML_OPENGL_ES + gladLoadGLES1(reinterpret_cast<GLADloadfunc>(sf::Context::getFunction)); +#else + gladLoadGL(reinterpret_cast<GLADloadfunc>(sf::Context::getFunction)); +#endif // Retrieve the context version number int majorVersion = 0; @@ -85,7 +96,6 @@ void ensureExtensionsInit() err() << "Ensure that hardware acceleration is enabled if available" << std::endl; } } -#endif } } // namespace priv |