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