Hi,
The wglewGetExtension function does not correctly parse the last extension in the list, as there is no space following it.
Here's an example string that shows the error.
"WGL_EXT_extensions_string WGL_ARB_extensions_string WGL_EXT_pixel_format WGL_ARB_pixel_format WGL_EXT_swap_control"
The WGL_EXT_swap_control extension will not get correctly detected.
This might also happen for the non-WGL extensions, I didn't check.
Yes, it appears that wglewGetExtension depends on there being a space at the end of each entry in the extension string:
while (p < end)
{
GLuint n = _glewStrCLen(p, ' ');
if (len == n && _glewStrSame((const GLubyte*)name, p, n)) return GL_TRUE;
p += n+1;
}
One way to fix this would be to modify the implementation of _glewStrCLen:
static GLuint _glewStrCLen (const GLubyte* s, GLubyte c)
{
GLuint i=0;
if (s == NULL) return 0;
while (s[i] != '\0' && s[i] != c) i++;
return s[i] == c ? i : 0;
}
Replacing the last line with: return ( s[i] == '\0' || s[i] == c ) ? i : 0;
_glewStrCLen is used in following places:
glewGetExtension
glewContextInit
wglewGetExtension
glxewGetExtension
Hi,
This is now fixed in the repository using Nigel's patch and will be
included in the 1.5.1 release.
Thanks!