Question

Trying to initialize the recent GLEW, the program interrupts and lldb gives the mentioned message.

Minimal example:

#define GLEW_STATIC
#include <GL/glew.h>

int main(int argc, const char * argv[]) {
    glewExperimental = GL_TRUE;
    glewInit();    <<<< EXC_BAD_ACCESS here
}

The stack frames the debugger outputs:

1 ___lldb_unnamed_function...:

libGLEW.1.10.0.dylib`___lldb_unnamed_function2$$libGLEW.1.10.0.dylib:
0x100005e30:  pushq  %rbp
0x100005e31:  movq   %rsp, %rbp
0x100005e34:  pushq  %r15
0x100005e36:  pushq  %r14
0x100005e38:  pushq  %r12
0x100005e3a:  pushq  %rbx
0x100005e3b:  movl   $7938, %edi
0x100005e40:  callq  0x100044668               ; symbol stub for: glGetString
0x100005e45:  movl   $1, %r14d        <<<< EXC_BAD_ACCESS here
0x100005e4b:  testq  %rax, %rax
0x100005e4e:  je     0x100034a86               ; ___lldb_unnamed_function2$$libGLEW.1.10.0.dylib + 191574
...

0 glGetString:

libGL.dylib`glGetString:
0x7fff8bfa28a6:  pushq  %rbp
0x7fff8bfa28a7:  movq   %rsp, %rbp
0x7fff8bfa28aa:  movl   %edi, %eax
0x7fff8bfa28ac:  movq   %gs:240, %rdx
0x7fff8bfa28b5:  movq   944(%rdx), %rcx    <<<< EXC_BAD_ACCESS here
0x7fff8bfa28bc:  movq   (%rdx), %rdi
0x7fff8bfa28bf:  movl   %eax, %esi
0x7fff8bfa28c1:  popq   %rbp
0x7fff8bfa28c2:  jmpq   *%rcx

Is this some error in GLEW, or in my configuration?

Was it helpful?

Solution

Obviously a gl context needs to be created first.

So in case of glfw, glfwCreateWindow needs to be successfully called before glewInit can.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top