From 14e6bf7b3673d4f59d2fc33425d9401cb13bd060 Mon Sep 17 00:00:00 2001 From: Sam Anthony Date: Sat, 26 Oct 2024 21:18:05 -0400 Subject: comments --- balls.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'balls.c') diff --git a/balls.c b/balls.c index 6e8dd15..cc3e7ec 100644 --- a/balls.c +++ b/balls.c @@ -146,33 +146,34 @@ void configureSharedData(void) { int err; - /* Create vertex array objects. */ + /* Create position array. */ glGenVertexArrays(1, &positionVAO); glBindVertexArray(positionVAO); + /* Create vertex array. */ glGenVertexArrays(1, &vertexVAO); glBindVertexArray(vertexVAO); - /* Create vertex buffers. */ + /* Create position buffer. */ glGenBuffers(1, &positionVBO); - glGenBuffers(1, &vertexVBO); - - /* Create VBO coordinates. */ glBindBuffer(GL_ARRAY_BUFFER, positionVBO); glBufferData(GL_ARRAY_BUFFER, 2 * NBALLS * sizeof(GLfloat), NULL, GL_DYNAMIC_DRAW); glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, 0, 0); glEnableVertexAttribArray(0); + /* Create vertex buffer. */ + glGenBuffers(1, &vertexVBO); glBindBuffer(GL_ARRAY_BUFFER, vertexVBO); glBufferData(GL_ARRAY_BUFFER, 2 * (CIRCLE_SEGS+2) * sizeof(GLfloat), NULL, GL_DYNAMIC_DRAW); glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, 0, 0); glEnableVertexAttribArray(0); - /* Create memory objects from VBOs. */ + /* Create CL memory object from position buffer. */ positionBuf = clCreateFromGLBuffer(context, CL_MEM_WRITE_ONLY, positionVBO, &err); if (err < 0) sysfatal("Failed to create buffer object from VBO.\n"); + /* Create CL memory object from vertex buffer. */ vertexBuf = clCreateFromGLBuffer(context, CL_MEM_WRITE_ONLY, vertexVBO, &err); if (err < 0) sysfatal("Failed to create buffer object from VBO.\n"); -- cgit v1.2.3