Skip to content

Commit 0af0dc1

Browse files
committed
[rcore][win32] fallback to finding functions from opengl32.dll
1 parent c1165fd commit 0af0dc1

File tree

1 file changed

+15
-7
lines changed

1 file changed

+15
-7
lines changed

src/platforms/rcore_desktop_win32.c

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -75,11 +75,6 @@
7575
#include <GL/gl.h>
7676
#include <GL/wglext.h>
7777

78-
// undefined the glad_glGetString macro definition
79-
#undef glGetString
80-
// this should come from win32's GL/gl.h...not sure why it's not in this context
81-
const GLubyte* WINAPI glGetString(GLenum);
82-
8378
// --------------------------------------------------------------------------------
8479
// This part of the file contains pure functions that never access global state.
8580
// This distinction helps keep the backend maintainable as the inputs and outputs
@@ -490,8 +485,21 @@ static BOOL IsWindows10Version1703OrGreaterWin32(void)
490485

491486
static void* FindProc(const char* name)
492487
{
493-
if (0 == strcmp(name, "glGetString")) return glGetString;
494-
return wglGetProcAddress(name);
488+
{
489+
void* proc = wglGetProcAddress(name);
490+
if (proc) return proc;
491+
}
492+
493+
static HMODULE opengl = NULL;
494+
if (!opengl) {
495+
opengl = LoadLibraryW(L"opengl32");
496+
}
497+
if (opengl) {
498+
void* proc = GetProcAddress(opengl, name);
499+
if (proc) return proc;
500+
}
501+
502+
return NULL;
495503
}
496504
static void* WglGetProcAddress(const char* name)
497505
{

0 commit comments

Comments
 (0)