When I first add several vertices to the buffer, these are the corresponding functions that I call
glGenVertexArrays(1, &_vao);
glBindVertexArray(_vao);
glGenBuffers(1, &_vbo);
glBindBuffer(GL_ARRAY_BUFFER, _vbo);
glBufferData(GL_ARRAY_BUFFER, vertices.size() * sizeof(float), &vertices[0], GL_STATIC_DRAW);
_posAttrib = glGetAttribLocation(program, "position");
glEnableVertexAttribArray(_posAttrib);
glVertexAttribPointer(_posAttrib,
4,
GL_FLOAT,
GL_FALSE,
0,
0);
glBindVertexArray(0);
But later in my program I want to add some more vertices.
I do it as follows (as part of a separate function:
add_vertices(x,y);
glGenBuffers(1, &_vbo);
glBindBuffer(GL_ARRAY_BUFFER, _vbo);
glBufferData(GL_ARRAY_BUFFER, (TRIANGLE_AMOUNT+1)*4*_number_of_circles * sizeof(float), &vertices[0], GL_STATIC_DRAW);
Assuming the funk size in glBufferData's second argument is fine, did I miss something? Are there any other OpenGL features that require a call?
I don't get any errors, but when I try to draw additional shapes with new vertices by going through glDrawArrays with different subsets of vertices, nothing happens.
I hope this is semi-coherent ... let me know if there is any information that I have not provided.
Greetings.