From: Brendan Hansen Date: Sat, 24 Oct 2020 03:46:48 +0000 (-0500) Subject: tiny cleanup X-Git-Url: https://git.brendanfh.com/?a=commitdiff_plain;h=1e683d394dc0c65d18ef8654ba6ee1fb81a62ab3;p=csc718.git tiny cleanup --- diff --git a/src/sim.cpp b/src/sim.cpp index 8ceaa8c..57ea297 100644 --- a/src/sim.cpp +++ b/src/sim.cpp @@ -325,15 +325,16 @@ main(i32 argc, char* argv[]) glGenBuffers(1, &body_buffer); glBindBuffer(GL_ARRAY_BUFFER, body_buffer); glBufferData(GL_ARRAY_BUFFER, sizeof(Body) * state->bodies.count, state->bodies.data, GL_STREAM_DRAW); - glEnableVertexAttribArray(1); - glEnableVertexAttribArray(2); - glEnableVertexAttribArray(3); - glVertexAttribDivisor(1, 1); - glVertexAttribDivisor(2, 1); - glVertexAttribDivisor(3, 1); + + foreach (i, 1, 4) + { + glEnableVertexAttribArray(i); + glVertexAttribDivisor(i, 1); + } glVertexAttribPointer(1, 2, GL_FLOAT, false, sizeof(Body), (void *) offsetof(Body, pos.x)); glVertexAttribPointer(2, 1, GL_FLOAT, false, sizeof(Body), (void *) offsetof(Body, mass)); glVertexAttribPointer(3, 1, GL_BYTE, false, sizeof(Body), (void *) offsetof(Body, color_idx)); + glBindBuffer(GL_ARRAY_BUFFER, -1); }