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
glfwPollEvents();
// Clear the screen to black
glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
glClear(GL_COLOR_BUFFER_BIT);
// Draw triangle
glDrawArrays(GL_TRIANGLES, 0, 3);
//printf("Drawing ...
");
glfwSwapBuffers(window); // swap the back buffer and front buffer after drawing finished
}