Created
November 30, 2011 08:16
-
-
Save ssube/1408414 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Install the hooks | |
IHookManagerRef hooker = m_Core->GetHookManager(); | |
hooker->Add(VOODOO_OGL_HOOK_PARAMS(wglCreateContext)); | |
hooker->Add(VOODOO_OGL_HOOK_PARAMS(wglDeleteContext)); | |
hooker->Add(VOODOO_OGL_HOOK_PARAMS(wglMakeCurrent)); | |
hooker->Add(VOODOO_OGL_HOOK_PARAMS(wglSwapLayerBuffers)); | |
// Now provide the funcs... | |
HGLRC WINAPI vwglCreateContext(HDC hdc) | |
{ | |
HGLRC result = wglCreateContext(hdc); | |
VoodooLogger->Log(LL_ModDebug, VOODOO_FROST_NAME, "wglCreateContext(%p) == %p", hdc, result); | |
return result; | |
} | |
bool WINAPI vwglDeleteContext(HGLRC hglrc) | |
{ | |
if (gSecondContext && gNwnWindow) | |
{ | |
VoodooFrost->SetGLRC(nullptr); | |
gSecondContext = false; | |
} | |
bool result = wglDeleteContext(hglrc); | |
VoodooLogger->Log(LL_ModDebug, VOODOO_FROST_NAME, "wglDeleteContext(%p) == %i", hglrc, result); | |
return result; | |
} | |
bool WINAPI vwglMakeCurrent(HDC hdc, HGLRC hglrc) | |
{ | |
bool result = wglMakeCurrent(hdc, hglrc); | |
VoodooLogger->Log(LL_ModDebug, VOODOO_FROST_NAME, L"wglMakeCurrent(%p, %p) == %i", hdc, hglrc, result); | |
// Tell the adapter the device context and gl render context | |
Variant dc = { UT_PVoid, hdc }; | |
Variant glrc = { UT_PVoid, hglrc }; | |
gpVoodooCore->GetAdapter()->SetProperty(L"wglCreateDC", &dc); | |
gpVoodooCore->GetAdapter()->SetProperty(L"wglCreateGLRC", &glrc ); | |
return result; | |
} | |
bool WINAPI vwglSwapLayerBuffers(HDC hdc, UINT uint) | |
{ | |
// Draw shaders here | |
bool result = wglSwapLayerBuffers(hdc, uint); | |
VoodooLogger->Log(LL_ModDebug, VOODOO_FROST_NAME, "wglSwapLayerBuffers(%p, %u) == %i", hdc, uint, result); | |
return result; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment