[GRASS-SVN] r73007 - grass/trunk/lib/nviz
svn_grass at osgeo.org
svn_grass at osgeo.org
Thu Jul 26 05:10:47 PDT 2018
Author: hcho
Date: 2018-07-26 05:10:46 -0700 (Thu, 26 Jul 2018)
New Revision: 73007
Modified:
grass/trunk/lib/nviz/render.c
Log:
nviz: Check if getting GL function addresses was successful
Modified: grass/trunk/lib/nviz/render.c
===================================================================
--- grass/trunk/lib/nviz/render.c 2018-07-26 01:14:16 UTC (rev 73006)
+++ grass/trunk/lib/nviz/render.c 2018-07-26 12:10:46 UTC (rev 73007)
@@ -30,11 +30,13 @@
static void *GetAnyGLFuncAddress(const char *name)
{
void *p = (void *)wglGetProcAddress(name);
- if(p == 0 || p == (void*)0x1 || p == (void*)0x2 || p == (void*)0x3 ||
+ if (p == 0 || p == (void*)0x1 || p == (void*)0x2 || p == (void*)0x3 ||
p == (void*)-1) {
HMODULE module = LoadLibraryA("opengl32.dll");
p = (void *)GetProcAddress(module, name);
}
+ if (!p)
+ G_fatal_error(_("Unable to get function address for %s"), name);
return p;
}
@@ -43,13 +45,13 @@
if (gl_funcs_found)
return;
- glGenFramebuffers = (PFNGLGENFRAMEBUFFERSPROC) GetAnyGLFuncAddress("glGenFramebuffers");
- glBindFramebuffer = (PFNGLBINDFRAMEBUFFERPROC) GetAnyGLFuncAddress("glBindFramebuffer");
- glGenRenderbuffers = (PFNGLGENRENDERBUFFERSPROC) GetAnyGLFuncAddress("glGenRenderbuffers");
- glBindRenderbuffer = (PFNGLBINDRENDERBUFFERPROC) GetAnyGLFuncAddress("glBindRenderbuffer");
- glRenderbufferStorage = (PFNGLRENDERBUFFERSTORAGEPROC) GetAnyGLFuncAddress("glRenderbufferStorage");
- glFramebufferRenderbuffer = (PFNGLFRAMEBUFFERRENDERBUFFERPROC) GetAnyGLFuncAddress("glFramebufferRenderbuffer");
- glCheckFramebufferStatus = (PFNGLCHECKFRAMEBUFFERSTATUSPROC) GetAnyGLFuncAddress("glCheckFramebufferStatus");
+ glGenFramebuffers = (PFNGLGENFRAMEBUFFERSPROC)GetAnyGLFuncAddress("glGenFramebuffers");
+ glBindFramebuffer = (PFNGLBINDFRAMEBUFFERPROC)GetAnyGLFuncAddress("glBindFramebuffer");
+ glGenRenderbuffers = (PFNGLGENRENDERBUFFERSPROC)GetAnyGLFuncAddress("glGenRenderbuffers");
+ glBindRenderbuffer = (PFNGLBINDRENDERBUFFERPROC)GetAnyGLFuncAddress("glBindRenderbuffer");
+ glRenderbufferStorage = (PFNGLRENDERBUFFERSTORAGEPROC)GetAnyGLFuncAddress("glRenderbufferStorage");
+ glFramebufferRenderbuffer = (PFNGLFRAMEBUFFERRENDERBUFFERPROC)GetAnyGLFuncAddress("glFramebufferRenderbuffer");
+ glCheckFramebufferStatus = (PFNGLCHECKFRAMEBUFFERSTATUSPROC)GetAnyGLFuncAddress("glCheckFramebufferStatus");
gl_funcs_found = 1;
}
More information about the grass-commit
mailing list