How to using glBufferData to update buffer data

Hi all, I am trying to update the buffer data to draw moving things using glBufferData.

The problem is this simple program memory usage increases over time. When I ran the valgrind to test leak memory, glfwSwapBuffers is reported definitely memory lost. Can any body help explained this? Thank you.

while (!glfwWindowShouldClose(window))
glBufferData(GL_ARRAY_BUFFER, sizeof(vertices1), vertices1, GL_STATIC_DRAW); \ inside loop draws nothing
// Retrieve window events

// Clear the screen to black
glClearColor(0.0f, 0.0f, 0.0f, 1.0f);

 // Draw triangle
glDrawArrays(GL_TRIANGLES, 0, 3);
//printf("Drawing ...

glfwSwapBuffers(window); // swap the back buffer and front buffer after drawing finished


This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.