Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Program Crash on glGenVertexArrays call

Tags:

c++

opengl

I am trying to learn how to program in opengl and am using this tutorial. Tutorial 1 works fine, tutorial 2 crashes with return 1.

It fails on this:

GLuint VertexArrayID;
glGenVertexArrays(1, &VertexArrayID);
glBindVertexArray(VertexArrayID);

Specifically:

glGenVertexArrays(1, &VertexArrayID);

Any suggestions? Also related but never solved OpenGL, FreeGlut and Glew crash with glGenVertexArrays call

like image 293
asbumste Avatar asked Nov 26 '12 02:11

asbumste


2 Answers

After reading this thread it appears that calling

glewExperimental = GL_TRUE; 
glewInit();

Would fix the problem. Reading up on glewExperiemental here, it says that

GLEW obtains information on the supported extensions from the graphics driver. Experimental or pre-release drivers, however, might not report every available extension through the standard mechanism, in which case GLEW will report it unsupported. To circumvent this situation, the glewExperimental global switch can be turned on by setting it to GL_TRUE before calling glewInit(), which ensures that all extensions with valid entry points will be exposed.

I'm not too sure how that helps with glGenVertexArrays, but it's worth the try

like image 126
emartel Avatar answered Nov 03 '22 04:11

emartel


Update your glew to 2.0.0. This was caused by this bug.

like image 21
dfelinto Avatar answered Nov 03 '22 05:11

dfelinto