I\'m trying to draw a triangle with VBOs. I do not see any pixels on the window. I do not see any GL_ERROR too.
Here is the code I am trying to run:
#inc
When not using shaders (as I assume you don't), one cannot use theglEnableVertexAttribArray/glVertexAttribPointer
methods.
What you can do instead is to use glVertexPointer
, which constructs a binding the the VBO when one is bound. The last parameter in this case specifies the offset in the buffer, which will be 0 in your case. (reference)
Something like this should do the trick:
glClear(GL_COLOR_BUFFER_BIT);
glEnableClientState(GL_VERTEX_ARRAY);
glBindBuffer(GL_ARRAY_BUFFER, VBO);
glVertexPointer(3, GL_FLOAT, 0, 0);
glDrawArrays(GL_TRIANGLES, 0, 3);
glDisableClientState(GL_VERTEX_ARRAY);