win32 stuff moved under pltf
This commit is contained in:
33
src/pltf/win32/gl_funcs.c
Normal file
33
src/pltf/win32/gl_funcs.c
Normal 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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user