From 8f13501beaad34d4d58178ab7a41747c28cf6faa Mon Sep 17 00:00:00 2001 From: Sam Anthony Date: Wed, 13 Nov 2024 10:55:38 -0500 Subject: move genVertices() out of display() --- balls.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/balls.c b/balls.c index 567e9d8..7fb3b3c 100644 --- a/balls.c +++ b/balls.c @@ -545,7 +545,8 @@ animate(int v) { collideBalls(); cpuEvent = collideWalls(); - /* Disply current from with GPU. */ + /* Display current frame with GPU. */ + genVertices(); display(); /* Copy next frame's positions from CPU to GPU. */ @@ -563,8 +564,6 @@ display(void) { glClear(GL_COLOR_BUFFER_BIT |GL_DEPTH_BUFFER_BIT); - genVertices(); - glBindVertexArray(vertexVAO); for (i = 0; i < nBalls; i++) glDrawArrays(GL_TRIANGLE_FAN, i*CIRCLE_POINTS, CIRCLE_POINTS); -- cgit v1.2.3