From afe367817add088d36306ad4b07d4bb2c4a6bf35 Mon Sep 17 00:00:00 2001 From: Jonathan Marler Date: Fri, 4 Apr 2025 11:12:36 -0600 Subject: [PATCH] [rcore][win32] fallback to finding functions from opengl32.dll --- src/platforms/rcore_desktop_win32.c | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/src/platforms/rcore_desktop_win32.c b/src/platforms/rcore_desktop_win32.c index 285a8beb6..9171a7d23 100644 --- a/src/platforms/rcore_desktop_win32.c +++ b/src/platforms/rcore_desktop_win32.c @@ -75,11 +75,6 @@ #include #include -// undefined the glad_glGetString macro definition -#undef glGetString -// this should come from win32's GL/gl.h...not sure why it's not in this context -const GLubyte* WINAPI glGetString(GLenum); - // -------------------------------------------------------------------------------- // This part of the file contains pure functions that never access global state. // This distinction helps keep the backend maintainable as the inputs and outputs @@ -490,8 +485,21 @@ static BOOL IsWindows10Version1703OrGreaterWin32(void) static void* FindProc(const char* name) { - if (0 == strcmp(name, "glGetString")) return glGetString; - return wglGetProcAddress(name); + { + void* proc = wglGetProcAddress(name); + if (proc) return proc; + } + + static HMODULE opengl = NULL; + if (!opengl) { + opengl = LoadLibraryW(L"opengl32"); + } + if (opengl) { + void* proc = GetProcAddress(opengl, name); + if (proc) return proc; + } + + return NULL; } static void* WglGetProcAddress(const char* name) {