View Full Version : glGenBuffers segfault

02-22-2010, 03:01 PM
When I try to call glGenBuffers, I get a segfault, and I have no idea why. I'm using the binary nVidia drivers for ubuntu 9.10, here's what I consider to be relevant parts of my glxinfo, glewinfo:

OpenGL vendor string: NVIDIA Corporation
OpenGL renderer string: GeForce 8800 GT/PCI/SSE2
OpenGL version string: 3.0.0 NVIDIA 185.18.36
OpenGL shading language version string: 1.30 NVIDIA via Cg compiler

GLEW version 1.5.1
Reporting capabilities of display :0.0, visual 0x2b
Running on a GeForce 8800 GT/PCI/SSE2 from NVIDIA Corporation
OpenGL version 3.0.0 NVIDIA 185.18.36 is supported
glBeginQuery: OK
glBindBuffer: OK
glBufferData: OK
glBufferSubData: OK
glDeleteBuffers: OK
glDeleteQueries: OK
glEndQuery: OK
glGenBuffers: OK
glGenQueries: OK
glGetBufferParameteriv: OK
glGetBufferPointerv: OK
glGetBufferSubData: OK
glGetQueryObjectiv: OK
glGetQueryObjectuiv: OK
glGetQueryiv: OK
glIsBuffer: OK
glIsQuery: OK
glMapBuffer: OK
glUnmapBuffer: OK

My code is here:

it segfaults, and gdb indicates that its on my call to glGenBuffers. Any help is GREATLY appreciated.


02-22-2010, 05:04 PM
The reason for your seg fault now is that you haven't allowed glew to set all the openGL entry points (like glGenBuffers). Try adding a glewInit() just after you create your window ... see glew info (http://glew.sourceforge.net/basic.html) for more details.

02-22-2010, 05:34 PM
You can actually print out the function value. Usually it's set to 0 instead of a "normal" function pointer, so you'll know glewInit() hasn't been called yet. If it is zero, it's definitely an init problem. Functions will often be set as to zero until they're initialized so you should see a 0 in the gdb error as well.

02-22-2010, 06:17 PM
You're a lifesaver. Thank you!!!