I am writing a hello world that draws a simple triangle and trying out VAO.
GLuint vbo;
GLuint vao;
.....
//initialize vertex data
const GLfloat vertices[] = {
0.0, 0.0, 0.0,
1.0, 0.0, 0.0,
1.0, 1.0, 0.0
};
glGenVertexArrays(1, &vao);
glBindVertexArray(vao);
glGenBuffers(1, &vbo);
glBindBuffer(GL_ARRAY_BUFFER, vbo);
glBufferData(GL_ARRAY_BUFFER, 36, vertices, GL_STATIC_DRAW); //becomes unresponsive at this point
Am I doing something absurdly wrong here for glBufferData to fail? I use cout statements after each of the gl calls to figure out where it fails and it failed at glbufferData. But as far as my beginner senses tell me I can see nothing wrong with it.
Your help is appreciated. Previously I used the old method (not VAO) so I am new to this.
As far as I know the arrays I made are equal and the third parameter to glBufferData which is the pointer to the start of the array is passed similarly. It seems like using the array initializer feature of C++ does not work for my implementation with VC2010.
You have an error elsewhere in your program. I pasted your code into a test program and it worked fine. I suggest you have a some sort of array overrun.