diff options
| author | Sam Anthony <sam@samanthony.xyz> | 2024-10-26 21:18:05 -0400 |
|---|---|---|
| committer | Sam Anthony <sam@samanthony.xyz> | 2024-10-26 21:18:05 -0400 |
| commit | 14e6bf7b3673d4f59d2fc33425d9401cb13bd060 (patch) | |
| tree | 1a2e43a46315e6fbebc2be63c02411930f4de7ce /balls.c | |
| parent | d0b7c4c404f5e7b05c66a527d536805c5845e30c (diff) | |
| download | balls-14e6bf7b3673d4f59d2fc33425d9401cb13bd060.zip | |
comments
Diffstat (limited to 'balls.c')
| -rw-r--r-- | balls.c | 13 |
1 files changed, 7 insertions, 6 deletions
@@ -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"); |