Squashed commit of the following: (#1248)

commit bbfb934e808c6602d3a059adf270e997b71b900c
Author: Rachael Alexanderson <madame-rachelle@users.noreply.github.com>
Date:   Sun Dec 6 23:50:15 2020 -0500

    - and now it builds! but ... does it run?

commit 67096c8966f28dcff40c998d10e5510d6a689a13
Author: Rachael Alexanderson <madame-rachelle@users.noreply.github.com>
Date:   Sun Dec 6 22:25:13 2020 -0500

    - one more step closer to compile

commit 5a0c84dd2d3e1798e7a99f4ec1696f678708f0e6
Author: Rachael Alexanderson <madame-rachelle@users.noreply.github.com>
Date:   Sun Dec 6 22:13:39 2020 -0500

    - set up dynamic opengl load for windows

commit 6ef8118b801f305000ce881a4b04aaaef0196226
Author: Rachael Alexanderson <madame-rachelle@users.noreply.github.com>
Date:   Sat Dec 5 16:38:53 2020 -0500

    - allow compiling for win-arm64

commit 7d6f3797c4393fa7b0ed567b94d1de135ecb5ac6
Author: Rachael Alexanderson <madame-rachelle@users.noreply.github.com>
Date:   Fri Dec 4 05:18:29 2020 -0500

    - allow targeting ARM64 on Windows

Co-authored-by: Rachael Alexanderson <madame-rachelle@users.noreply.github.com>
This commit is contained in:
Rachael Alexanderson 2020-12-10 09:16:28 -05:00 committed by GitHub
commit 64ff15b82b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 98 additions and 19 deletions

View file

@ -67,10 +67,51 @@ static int TestPointer(const PROC pTest)
return 1;
}
static HMODULE opengl32dll;
static HGLRC(WINAPI* createcontext)(HDC);
static BOOL(WINAPI* deletecontext)(HGLRC);
static BOOL(WINAPI* makecurrent)(HDC, HGLRC);
static PROC(WINAPI* getprocaddress)(LPCSTR name);
static void CheckOpenGL(void)
{
if (opengl32dll == 0)
{
opengl32dll = LoadLibrary(L"OpenGL32.DLL");
createcontext = (HGLRC(WINAPI*)(HDC)) GetProcAddress(opengl32dll, "wglCreateContext");
deletecontext = (BOOL(WINAPI*)(HGLRC)) GetProcAddress(opengl32dll, "wglDeleteContext");
makecurrent = (BOOL(WINAPI*)(HDC, HGLRC)) GetProcAddress(opengl32dll, "wglMakeCurrent");
getprocaddress = (PROC(WINAPI*)(LPCSTR)) GetProcAddress(opengl32dll, "wglGetProcAddress");
}
}
HGLRC zd_wglCreateContext(HDC dc)
{
CheckOpenGL();
return createcontext(dc);
}
BOOL zd_wglDeleteContext(HGLRC context)
{
CheckOpenGL();
return deletecontext(context);
}
BOOL zd_wglMakeCurrent(HDC dc, HGLRC context)
{
CheckOpenGL();
return makecurrent(dc, context);
}
PROC zd_wglGetProcAddress(LPCSTR name)
{
CheckOpenGL();
return getprocaddress(name);
}
static PROC WinGetProcAddress(const char *name)
{
HMODULE glMod = NULL;
PROC pFunc = wglGetProcAddress((LPCSTR)name);
PROC pFunc = zd_wglGetProcAddress((LPCSTR)name);
if(TestPointer(pFunc))
{
return pFunc;