mirror of
https://github.com/minetest/irrlicht.git
synced 2025-07-01 15:50:27 +02:00
Add a unified cross platform OpenGL core profile binding (#52)
This commit is contained in:
@ -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);
|
||||
|
Reference in New Issue
Block a user