diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-07-12 19:03:01 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-07-12 19:03:01 +0300 |
commit | 04ef9efcdf1de5de7fc17cdc3aa6411757df9dd8 (patch) | |
tree | 9fae31b915432cdd2b09e180f6eb3dc8a664891f /src/render | |
parent | 52009c2a994e1f9cfdb8dfee6641a21ef49865c9 (diff) | |
download | manaverse-04ef9efcdf1de5de7fc17cdc3aa6411757df9dd8.tar.gz manaverse-04ef9efcdf1de5de7fc17cdc3aa6411757df9dd8.tar.bz2 manaverse-04ef9efcdf1de5de7fc17cdc3aa6411757df9dd8.tar.xz manaverse-04ef9efcdf1de5de7fc17cdc3aa6411757df9dd8.zip |
Simplify assignFunction and add two args function assignFunction2.
Diffstat (limited to 'src/render')
-rw-r--r-- | src/render/mglfunctions.h | 13 | ||||
-rw-r--r-- | src/render/mglxinit.cpp | 14 |
2 files changed, 18 insertions, 9 deletions
diff --git a/src/render/mglfunctions.h b/src/render/mglfunctions.h index bfddb5a2c..569f4aac4 100644 --- a/src/render/mglfunctions.h +++ b/src/render/mglfunctions.h @@ -36,7 +36,16 @@ reinterpret_cast<const GLubyte*>(name)) #endif -#define assignFunction(func, name) \ +#define assignFunction(func) \ + { \ + m##func = reinterpret_cast<func##_t>(getFunction(#func)); \ + if (m##func == nullptr) \ + logger->log("function not found: " #func); \ + else \ + logger->log("assigned function: " #func); \ + } + +#define assignFunction2(func, name) \ { \ m##func = reinterpret_cast<func##_t>(getFunction(name)); \ if (m##func == nullptr) \ @@ -45,7 +54,7 @@ logger->log(std::string("assigned function: ") + name); \ } -#define assignFunctionEmu(func, name) \ +#define assignFunctionEmu2(func, name) \ { \ m##func = reinterpret_cast<func##_t>(getFunction(name)); \ if (m##func == nullptr) \ diff --git a/src/render/mglxinit.cpp b/src/render/mglxinit.cpp index 8908b1b4f..e6763d45e 100644 --- a/src/render/mglxinit.cpp +++ b/src/render/mglxinit.cpp @@ -30,13 +30,13 @@ void Glx::initFunctions() { - assignFunction(glXCreateContext, "glXCreateContext"); - assignFunction(glXGetCurrentContext, "glXGetCurrentContext"); - assignFunction(glXCreateContextAttribs, "glXCreateContextAttribsARB"); - assignFunction(glXChooseFBConfig, "glXChooseFBConfig"); - assignFunction(glXDestroyContext, "glXDestroyContext"); - assignFunction(glXMakeCurrent, "glXMakeCurrent"); - assignFunction(glXSwapBuffers, "glXSwapBuffers"); + assignFunction2(glXCreateContext, "glXCreateContext"); + assignFunction2(glXGetCurrentContext, "glXGetCurrentContext"); + assignFunction2(glXCreateContextAttribs, "glXCreateContextAttribsARB"); + assignFunction2(glXChooseFBConfig, "glXChooseFBConfig"); + assignFunction2(glXDestroyContext, "glXDestroyContext"); + assignFunction2(glXMakeCurrent, "glXMakeCurrent"); + assignFunction2(glXSwapBuffers, "glXSwapBuffers"); } #endif |