Oh my, it worked. Clean up time
This commit is contained in:
@@ -334,21 +334,6 @@ int main(int argc, char* argv[])
|
|||||||
// Work size, for each y line
|
// Work size, for each y line
|
||||||
size_t global_work_size[1] = { 10 };
|
size_t global_work_size[1] = { 10 };
|
||||||
|
|
||||||
status = clEnqueueAcquireGLObjects(commandQueue, 1, &frontBuffer, 0, 0, 0);
|
|
||||||
glFinish();
|
|
||||||
status = clEnqueueNDRangeKernel(commandQueue, compute_kernel, 1, NULL, global_work_size, NULL, 0, NULL, NULL);
|
|
||||||
glFinish();
|
|
||||||
//status = clEnqueueReadBuffer(commandQueue, frontBuffer, CL_TRUE, 0, GRID_WIDTH * GRID_HEIGHT * 4 * sizeof(unsigned char), (void*)pixel_array, 0, NULL, NULL);
|
|
||||||
|
|
||||||
status = clEnqueueReleaseGLObjects(commandQueue, 1, &frontBuffer, 0, NULL, NULL);
|
|
||||||
glFinish();
|
|
||||||
|
|
||||||
// ======================================= Rendering Shtuff =================================================
|
|
||||||
|
|
||||||
glfwPollEvents();
|
|
||||||
|
|
||||||
// Render
|
|
||||||
|
|
||||||
glActiveTexture(GL_TEXTURE0);
|
glActiveTexture(GL_TEXTURE0);
|
||||||
glBindTexture(GL_TEXTURE_2D, texture);
|
glBindTexture(GL_TEXTURE_2D, texture);
|
||||||
glUniform1i(glGetUniformLocation(ourShader.Program, "ourTexture1"), 0);
|
glUniform1i(glGetUniformLocation(ourShader.Program, "ourTexture1"), 0);
|
||||||
@@ -359,6 +344,26 @@ int main(int argc, char* argv[])
|
|||||||
glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_INT, 0);
|
glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_INT, 0);
|
||||||
glBindVertexArray(0);
|
glBindVertexArray(0);
|
||||||
|
|
||||||
|
glFinish();
|
||||||
|
|
||||||
|
status = clEnqueueAcquireGLObjects(commandQueue, 1, &frontBuffer, 0, 0, 0);
|
||||||
|
|
||||||
|
status = clEnqueueNDRangeKernel(commandQueue, compute_kernel, 1, NULL, global_work_size, NULL, 0, NULL, NULL);
|
||||||
|
|
||||||
|
//status = clEnqueueReadBuffer(commandQueue, frontBuffer, CL_TRUE, 0, GRID_WIDTH * GRID_HEIGHT * 4 * sizeof(unsigned char), (void*)pixel_array, 0, NULL, NULL);
|
||||||
|
|
||||||
|
status = clEnqueueReleaseGLObjects(commandQueue, 1, &frontBuffer, 0, NULL, NULL);
|
||||||
|
|
||||||
|
clFinish(commandQueue);
|
||||||
|
|
||||||
|
// ======================================= Rendering Shtuff =================================================
|
||||||
|
|
||||||
|
glfwPollEvents();
|
||||||
|
|
||||||
|
// Render
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Swap the screen buffers
|
// Swap the screen buffers
|
||||||
glfwSwapBuffers(gl_window);
|
glfwSwapBuffers(gl_window);
|
||||||
|
|
||||||
|
|||||||
@@ -4,22 +4,18 @@ __kernel void conway_compute(__write_only image2d_t front_grid, __global int* nu
|
|||||||
//int width = *grid_width;
|
//int width = *grid_width;
|
||||||
//int height = grid_height;
|
//int height = grid_height;
|
||||||
|
|
||||||
int2 pixelcoord = (int2) (get_global_id(0), get_global_id(1));
|
for (int i = 0; i < 90000; i ++){
|
||||||
|
int2 pixelcoord = (int2) (i % *grid_width, i / *grid_height);
|
||||||
//if (pixelcoord.x < width && pixelcoord.y < height)
|
//if (pixelcoord.x < width && pixelcoord.y < height)
|
||||||
//{
|
//{
|
||||||
//float4 pixel = read_imagef(image1, sampler, (int2)(pixelcoord.x, pixelcoord.y));
|
//float4 pixel = read_imagef(image1, sampler, (int2)(pixelcoord.x, pixelcoord.y));
|
||||||
float4 black = (float4)(0,0,0,0);
|
int4 black = (int4)(0,0,0,0);
|
||||||
|
|
||||||
|
|
||||||
//write_imagef(front_grid, pixelcoord, black);
|
//write_imagef(front_grid, pixelcoord, black);
|
||||||
|
|
||||||
|
write_imagei(front_grid, pixelcoord, black);
|
||||||
|
|
||||||
int num = *grid_width * *grid_height * 4;
|
|
||||||
|
|
||||||
for (int i = 0; i < num ; i += 4){
|
|
||||||
|
|
||||||
write_imagef(front_grid, pixelcoord, black);
|
|
||||||
//
|
|
||||||
}
|
}
|
||||||
//}
|
//}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user