22 #ifndef RENDER_OPENGL_MGLFUNCTIONS_H
23 #define RENDER_OPENGL_MGLFUNCTIONS_H
32 #define getFunction(name) wglGetProcAddress(name)
34 #define getFunction(name) eglGetProcAddress(name)
35 #elif defined __APPLE__
36 #define getFunction(name) nullptr
37 #elif defined __native_client__
38 #define getFunction(name) glGetProcAddressREGAL(name)
39 #elif defined(__SWITCH__)
40 #define getFunction(name) SDL_GL_GetProcAddress(name)
42 #define getFunction(name) glXGetProcAddress(\
43 reinterpret_cast<const GLubyte*>(name))
46 #define assignFunction(func) \
48 m##func = reinterpret_cast<func##_t>(getFunction(#func)); \
49 if (m##func == nullptr) \
50 logger->log("function not found: " #func); \
52 logger->log("assigned function: " #func); \
55 #define assignFunction3(func, ext) \
57 m##func = reinterpret_cast<func##_t>(getFunction(#func#ext)); \
58 if (m##func == nullptr) \
60 logger->log("function not found: " #func#ext); \
61 m##func = reinterpret_cast<func##_t>(getFunction(#func)); \
62 if (m##func == nullptr) \
63 logger->log("function not found: " #func); \
65 logger->log("assigned function: " #func); \
69 logger->log("assigned function: " #func#ext); \
73 #define assignFunctionARB(func) assignFunction3(func, ARB)
75 #define assignFunctionEXT(func) assignFunction3(func, EXT)
77 #define assignFunction2(func, name) \
79 m##func = reinterpret_cast<func##_t>(getFunction(name)); \
80 if (m##func == nullptr) \
81 logger->log(std::string("function not found: ") + name); \
83 logger->log(std::string("assigned function: ") + name); \
86 #define assignFunctionEmu2(func, name) \
88 m##func = reinterpret_cast<func##_t>(getFunction(name)); \
89 if (m##func == nullptr) \
91 m##func = emu##func; \
92 logger->log(std::string("emulated function: ") + name); \
96 logger->log(std::string("assigned function: ") + name); \
100 #define emulateFunction(func) m##func = emu##func; \
101 logger->log("emulated function: " #func)