Commit f80a46cd authored by Aashish Chaudhary's avatar Aashish Chaudhary Committed by Kitware Robot

Merge topic 'fix_glew_ext_gl2'

cf8933f1 Fix GL extensions not reported on Mac OpenGL2 context
Acked-by: Kitware Robot's avatarKitware Robot <kwrobot@kitware.com>
Reviewed-by: Ken Martin's avatarKen Martin <ken.martin@kitware.com>
Merge-request: !224
parents 83d3d738 cf8933f1
......@@ -10111,6 +10111,7 @@ static const GLubyte* _glewGetExtensions(void) {
static int s_init = 0;
static GLubyte s_array[16384];
static const GLubyte* s_ret = 0;
GLint num_extensions = -1;
if (s_init == 0) {
PFNGLGETSTRINGIPROC localGetStringi = 0;
......@@ -10119,13 +10120,15 @@ static const GLubyte* _glewGetExtensions(void) {
localGetStringi = (PFNGLGETSTRINGIPROC)glewGetProcAddress((const GLubyte*)"glGetStringi");
if (localGetStringi) {
GLint num_extensions = 0;
// Checking for localGetStringi is not enough as it was valid on a
// Mac OpenGL2 context and that is why the code path never reached
// the else statement which uses glGetString call.
glGetIntegerv(GL_NUM_EXTENSIONS, &num_extensions);
if (localGetStringi && num_extensions >= 0) {
GLint extension_idx = 0;
GLuint arr_idx = 0;
glGetIntegerv(GL_NUM_EXTENSIONS, &num_extensions);
for ( ; extension_idx < num_extensions; ++extension_idx) {
const GLubyte* extension = localGetStringi(GL_EXTENSIONS, extension_idx);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment