summaryrefslogtreecommitdiff
path: root/src/render
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-07-12 21:17:51 +0300
committerAndrei Karas <akaras@inbox.ru>2014-07-12 21:17:51 +0300
commit18b2da68d0ae157778bab38d6a90f71e5bb95da2 (patch)
tree6e5ee2ecba42ad230c93362b5cefbd967a04ca3e /src/render
parent04ef9efcdf1de5de7fc17cdc3aa6411757df9dd8 (diff)
downloadmanaplus-18b2da68d0ae157778bab38d6a90f71e5bb95da2.tar.gz
manaplus-18b2da68d0ae157778bab38d6a90f71e5bb95da2.tar.bz2
manaplus-18b2da68d0ae157778bab38d6a90f71e5bb95da2.tar.xz
manaplus-18b2da68d0ae157778bab38d6a90f71e5bb95da2.zip
Add functions to get ARB or EXT OpenGL functions.
Diffstat (limited to 'src/render')
-rw-r--r--src/render/mglfunctions.h22
-rw-r--r--src/render/mglxinit.cpp14
2 files changed, 29 insertions, 7 deletions
diff --git a/src/render/mglfunctions.h b/src/render/mglfunctions.h
index 569f4aac4..23e3bea6d 100644
--- a/src/render/mglfunctions.h
+++ b/src/render/mglfunctions.h
@@ -45,6 +45,28 @@
logger->log("assigned function: " #func); \
}
+#define assignFunction3(func, ext) \
+ { \
+ m##func = reinterpret_cast<func##_t>(getFunction(#func#ext)); \
+ if (m##func == nullptr) \
+ { \
+ logger->log("function not found: " #func#ext); \
+ m##func = reinterpret_cast<func##_t>(getFunction(#func)); \
+ if (m##func == nullptr) \
+ logger->log("function not found: " #func); \
+ else \
+ logger->log("assigned function: " #func); \
+ } \
+ else \
+ { \
+ logger->log("assigned function: " #func#ext); \
+ } \
+ }
+
+#define assignFunctionARB(func) assignFunction3(func, ARB)
+
+#define assignFunctionEXT(func) assignFunction3(func, EXT)
+
#define assignFunction2(func, name) \
{ \
m##func = reinterpret_cast<func##_t>(getFunction(name)); \
diff --git a/src/render/mglxinit.cpp b/src/render/mglxinit.cpp
index e6763d45e..23c592d8d 100644
--- a/src/render/mglxinit.cpp
+++ b/src/render/mglxinit.cpp
@@ -30,13 +30,13 @@
void Glx::initFunctions()
{
- assignFunction2(glXCreateContext, "glXCreateContext");
- assignFunction2(glXGetCurrentContext, "glXGetCurrentContext");
- assignFunction2(glXCreateContextAttribs, "glXCreateContextAttribsARB");
- assignFunction2(glXChooseFBConfig, "glXChooseFBConfig");
- assignFunction2(glXDestroyContext, "glXDestroyContext");
- assignFunction2(glXMakeCurrent, "glXMakeCurrent");
- assignFunction2(glXSwapBuffers, "glXSwapBuffers");
+ assignFunction(glXCreateContext);
+ assignFunction(glXGetCurrentContext);
+ assignFunctionARB(glXCreateContextAttribs);
+ assignFunction(glXChooseFBConfig);
+ assignFunction(glXDestroyContext);
+ assignFunction(glXMakeCurrent);
+ assignFunction(glXSwapBuffers);
}
#endif