After initializing the VBO as:
GLuint vertex_buffer;
glGenBuffers(1, &vertex_buffer);
glBindBuffer(GL_ARRAY_BUFFER, vertex_buffer);
glBufferData(GL_ARRAY_BUFFER, data_size_in_bytes, data_vertices, GL_STATIC_DRAW);
data_vertices
stores some points data. When pushing back new points and resizing data_vertices
(making it larger), is it necessary to call glDeleteBuffers
/glGenBuffers
before glBindBuffer
or just glBindBuffer
?
GLuint vertex_buffer;
glDeleteBuffers(1, &vertex_buffer); // is this necessary?
glGenBuffers(1, &vertex_buffer); // is this necessary?
glBindBuffer(GL_ARRAY_BUFFER, vertex_buffer);
glBufferData(GL_ARRAY_BUFFER, new_data_size_in_bytes, new_data_vertices, GL_STATIC_DRAW);
If glDeleteBuffers
/glGenBuffers
aren’t called in every update frame, some computers may experience points disappearing.