aboutsummaryrefslogtreecommitdiff
path: root/source/Irrlicht/CWGLManager.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/Irrlicht/CWGLManager.cpp')
-rw-r--r--source/Irrlicht/CWGLManager.cpp19
1 files changed, 17 insertions, 2 deletions
diff --git a/source/Irrlicht/CWGLManager.cpp b/source/Irrlicht/CWGLManager.cpp
index b807acb..3d6e4f8 100644
--- a/source/Irrlicht/CWGLManager.cpp
+++ b/source/Irrlicht/CWGLManager.cpp
@@ -21,7 +21,7 @@ namespace video
{
CWGLManager::CWGLManager()
- : PrimaryContext(SExposedVideoData(0)), PixelFormat(0)
+ : PrimaryContext(SExposedVideoData(0)), PixelFormat(0), libHandle(NULL)
{
#ifdef _DEBUG
setDebugName("CWGLManager");
@@ -322,6 +322,8 @@ void CWGLManager::terminate()
if (PrimaryContext.OpenGLWin32.HDc && PrimaryContext.OpenGLWin32.HDc == CurrentContext.OpenGLWin32.HDc)
memset(&PrimaryContext, 0, sizeof(PrimaryContext));
memset(&CurrentContext, 0, sizeof(CurrentContext));
+ if (libHandle)
+ FreeLibrary(libHandle);
}
bool CWGLManager::generateSurface()
@@ -367,7 +369,7 @@ bool CWGLManager::generateSurface()
if (PixelFormat)
break;
}
-
+
// set pixel format
if (!SetPixelFormat(HDc, PixelFormat, &pfd))
{
@@ -490,6 +492,19 @@ void CWGLManager::destroyContext()
}
}
+void* CWGLManager::getProcAddress(const std::string &procName)
+{
+ void* proc = NULL;
+ proc = (void*)wglGetProcAddress(procName.c_str());
+ if (!proc) { // Fallback
+ if (!libHandle)
+ libHandle = LoadLibraryA("opengl32.dll");
+ if (libHandle)
+ proc = (void*)GetProcAddress(libHandle, procName.c_str());
+ }
+ return proc;
+}
+
bool CWGLManager::swapBuffers()
{
return SwapBuffers((HDC)CurrentContext.OpenGLWin32.HDc) == TRUE;