diff options
author | hecks <42101236+hecktest@users.noreply.github.com> | 2021-08-07 21:56:00 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-07 21:56:00 +0200 |
commit | 5bf68b5731b1817c31959b8e3adf19a4c2307630 (patch) | |
tree | bcd0af6f07df105882f0353cd610abf00e26fe2e /source/Irrlicht/CGLXManager.cpp | |
parent | 7709e1e5f8d8429308ae20d366171fdf6e64bee8 (diff) | |
download | irrlicht-5bf68b5731b1817c31959b8e3adf19a4c2307630.tar.xz |
Add a unified cross platform OpenGL core profile binding (#52)
Diffstat (limited to 'source/Irrlicht/CGLXManager.cpp')
-rw-r--r-- | source/Irrlicht/CGLXManager.cpp | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/source/Irrlicht/CGLXManager.cpp b/source/Irrlicht/CGLXManager.cpp index 6edf779..a5dc95d 100644 --- a/source/Irrlicht/CGLXManager.cpp +++ b/source/Irrlicht/CGLXManager.cpp @@ -7,6 +7,7 @@ #ifdef _IRR_COMPILE_WITH_GLX_MANAGER_
#include "os.h"
+#include <dlfcn.h>
#if defined(_IRR_OPENGL_USE_EXTPOINTER_)
#define GL_GLEXT_LEGACY 1
@@ -28,7 +29,7 @@ namespace video {
CGLXManager::CGLXManager(const SIrrlichtCreationParameters& params, const SExposedVideoData& videodata, int screennr)
- : Params(params), PrimaryContext(videodata), VisualInfo(0), glxFBConfig(0), GlxWin(0)
+ : Params(params), PrimaryContext(videodata), VisualInfo(0), glxFBConfig(0), GlxWin(0), libHandle(NULL)
{
#ifdef _DEBUG
setDebugName("CGLXManager");
@@ -279,6 +280,8 @@ bool CGLXManager::initialize(const SIrrlichtCreationParameters& params, const SE void CGLXManager::terminate()
{
+ if (libHandle)
+ dlclose(libHandle);
memset(&CurrentContext, 0, sizeof(CurrentContext));
}
@@ -428,6 +431,19 @@ void CGLXManager::destroyContext() }
}
+void* CGLXManager::getProcAddress(const std::string &procName)
+{
+ void* proc = NULL;
+ proc = (void*)glXGetProcAddressARB(reinterpret_cast<const GLubyte*>(procName.c_str()));
+ if (!proc) {
+ if (!libHandle)
+ libHandle = dlopen("libGL.so", RTLD_LAZY);
+ if (libHandle)
+ proc = dlsym(libHandle, procName.c_str());
+ }
+ return proc;
+}
+
bool CGLXManager::swapBuffers()
{
glXSwapBuffers((Display*)CurrentContext.OpenGLLinux.X11Display, CurrentContext.OpenGLLinux.GLXWindow);
|