summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-08-12 01:29:00 +0300
committerAndrei Karas <akaras@inbox.ru>2012-08-12 01:29:33 +0300
commit5692fe8584be17966f7bed2e97d22139f71619e3 (patch)
tree240418871aeea02266e24e7e2006172033b01e55
parentfacd5fbaa7724ecb56f30fbbefcab9a426d4966b (diff)
downloadmanaverse-5692fe8584be17966f7bed2e97d22139f71619e3.tar.gz
manaverse-5692fe8584be17966f7bed2e97d22139f71619e3.tar.bz2
manaverse-5692fe8584be17966f7bed2e97d22139f71619e3.tar.xz
manaverse-5692fe8584be17966f7bed2e97d22139f71619e3.zip
Simplify FBO functions declaration.
-rw-r--r--src/graphicsmanager.cpp39
1 files changed, 21 insertions, 18 deletions
diff --git a/src/graphicsmanager.cpp b/src/graphicsmanager.cpp
index d0464ae45..b14ec1688 100644
--- a/src/graphicsmanager.cpp
+++ b/src/graphicsmanager.cpp
@@ -420,6 +420,8 @@ void GraphicsManager::deleteFBO(FBOInfo *fbo)
#define getFunction(name) glXGetProcAddress((const GLubyte*)(name))
#endif
+#define assignFunction(func, name) m##func = (func##_t)getFunction(name)
+
void GraphicsManager::initOpenGLFunctions()
{
if (!checkGLVersion(1, 1))
@@ -427,27 +429,28 @@ void GraphicsManager::initOpenGLFunctions()
if (supportExtension("GL_ARB_framebuffer_object"))
{ // frame buffer supported
- mglGenRenderbuffers = (glGenRenderbuffers_t)getFunction("glGenRenderbuffers");
- mglBindRenderbuffer = (glBindRenderbuffer_t)getFunction("glBindRenderbuffer");
- mglRenderbufferStorage = (glRenderbufferStorage_t)getFunction("glRenderbufferStorage");
- mglGenFramebuffers = (glGenFramebuffers_t)getFunction("glGenFramebuffers");
- mglBindFramebuffer = (glBindFramebuffer_t)getFunction("glBindFramebuffer");
- mglFramebufferTexture2D = (glFramebufferTexture2D_t)getFunction("glFramebufferTexture2D");
- mglFramebufferRenderbuffer = (glFramebufferRenderbuffer_t)getFunction("glFramebufferRenderbuffer");
- mglDeleteFramebuffers = (glDeleteFramebuffers_t)getFunction("glDeleteFramebuffers");
- mglDeleteRenderbuffers = (glDeleteRenderbuffers_t)getFunction("glDeleteRenderbuffers");
+ assignFunction(glGenRenderbuffers, "glGenRenderbuffers");
+ assignFunction(glBindRenderbuffer, "glBindRenderbuffer");
+ assignFunction(glRenderbufferStorage, "glRenderbufferStorage");
+ assignFunction(glGenFramebuffers, "glGenFramebuffers");
+ assignFunction(glBindFramebuffer, "glBindFramebuffer");
+ assignFunction(glFramebufferTexture2D, "glFramebufferTexture2D");
+ assignFunction(glFramebufferRenderbuffer, "glFramebufferRenderbuffer");
+ assignFunction(glDeleteFramebuffers, "glDeleteFramebuffers");
+ assignFunction(glDeleteRenderbuffers, "glDeleteRenderbuffers");
}
else if (supportExtension("GL_EXT_framebuffer_object"))
{ // old frame buffer extension
- mglGenRenderbuffers = (glGenRenderbuffers_t)getFunction("glGenRenderbuffersEXT");
- mglBindRenderbuffer = (glBindRenderbuffer_t)getFunction("glBindRenderbufferEXT");
- mglRenderbufferStorage = (glRenderbufferStorage_t)getFunction("glRenderbufferStorageEXT");
- mglGenFramebuffers = (glGenFramebuffers_t)getFunction("glGenFramebuffersEXT");
- mglBindFramebuffer = (glBindFramebuffer_t)getFunction("glBindFramebufferEXT");
- mglFramebufferTexture2D = (glFramebufferTexture2D_t)getFunction("glFramebufferTexture2DEXT");
- mglFramebufferRenderbuffer = (glFramebufferRenderbuffer_t)getFunction("glFramebufferRenderbufferEXT");
- mglDeleteFramebuffers = (glDeleteFramebuffers_t)getFunction("glDeleteFramebuffersEXT");
- mglDeleteRenderbuffers = (glDeleteRenderbuffers_t)getFunction("glDeleteRenderbuffersEXT");
+ assignFunction(glGenRenderbuffers, "glGenRenderbuffersEXT");
+ assignFunction(glBindRenderbuffer, "glBindRenderbufferEXT");
+ assignFunction(glRenderbufferStorage, "glRenderbufferStorageEXT");
+ assignFunction(glGenFramebuffers, "glGenFramebuffersEXT");
+ assignFunction(glBindFramebuffer, "glBindFramebufferEXT");
+ assignFunction(glFramebufferTexture2D, "glFramebufferTexture2DEXT");
+ assignFunction(glFramebufferRenderbuffer,
+ "glFramebufferRenderbufferEXT");
+ assignFunction(glDeleteFramebuffers, "glDeleteFramebuffersEXT");
+ assignFunction(glDeleteRenderbuffers, "glDeleteRenderbuffersEXT");
}
else
{ // no frame buffer support