Segmentation Fault glGenBuffers


I’m a beginner programming in OpenGL. I need to create a POB (pixel Object Buffer), at time of compilation it has no errors, but at time of execution it presents a segmentation failure, my code is:

unsigned int width = 256;
unsigned int height = 256;
unsigned int size=widthheight4*sizeof(float);
GLuint vbo;

printf("vbo = %u
", vbo);
printf("err = %u
", glGetError());
glBindBuffer(GL_ARRAY_BUFFER,vbo); //bind object with vbo


Do you have a current GL context at the time this is called? If not, it’ll segfault.

Or if you didn’t previously got the function pointers.

First thing to do is to set a breakpoint at your first printf and check that glGenBuffers is non-zero. You can also check “if (GLEW_ARB_vertex_buffer_object)” to make sure that your 3D card actually does support VBOs (which is what you are creating here).

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.