[rcore][win32] fallback to finding functions from opengl32.dll

This commit is contained in:
Jonathan Marler 2025-04-04 11:12:36 -06:00
parent 6db18524b4
commit afe367817a

View File

@ -75,11 +75,6 @@
#include <GL/gl.h> #include <GL/gl.h>
#include <GL/wglext.h> #include <GL/wglext.h>
// 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 part of the file contains pure functions that never access global state.
// This distinction helps keep the backend maintainable as the inputs and outputs // 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) 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) static void* WglGetProcAddress(const char* name)
{ {