win32 stuff moved under pltf

This commit is contained in:
2026-07-03 17:32:50 +03:00
parent ea8c4bba36
commit 10a96ec02b
8 changed files with 385 additions and 391 deletions

33
src/pltf/win32/gl_funcs.c Normal file
View File

@@ -0,0 +1,33 @@
#include "../gl_funcs.h"
#include "log.h"
#include "pltf_win32.h"
#define X(type, name) \
type name = NULL
PLTF_GL_FUNCS(X)
#undef X
#define X(type, name) \
name = (type) pltf_gl_function_load(#name)
void* pltf_gl_function_load(const char* name) {
void* gl_func = (void*) wglGetProcAddress(name);
if (gl_func == NULL || gl_func == (void*) 1 || gl_func == (void*) 2 || gl_func == (void*) 3 || gl_func == (void*) -1) {
void* gl32_func = (void*) GetProcAddress(opengl_module, name);
if (gl32_func == NULL || gl32_func == (void*) 1 || gl32_func == (void*) 2 || gl32_func == (void*) 3 || gl32_func == (void*) -1) {
LOG_ERRORF("wglGetProcAddress failed to load gl function %s. Returned %p\n", name, gl_func);
LOG_ERRORF("GetProcAddress failed to load gl function %s. Returned %p\n", name, gl32_func);
return NULL;
}
return gl32_func;
}
return gl_func;
}
void pltf_gl_funcs_load() {
PLTF_GL_FUNCS(X)
}