summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSam Anthony <sam@samanthony.xyz>2024-11-13 10:55:38 -0500
committerSam Anthony <sam@samanthony.xyz>2024-11-13 10:55:38 -0500
commit8f13501beaad34d4d58178ab7a41747c28cf6faa (patch)
tree73b8cfbb5cf7e2d641d6072a0865b06f57c0a917
parent0d578ef5b2b0befb3788b8f8405d1713b3e7ee13 (diff)
downloadballs-8f13501beaad34d4d58178ab7a41747c28cf6faa.zip
move genVertices() out of display()
-rw-r--r--balls.c5
1 files 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);