@ -334,14 +334,27 @@ 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 ) ;
glActiveTexture ( GL_TEXTURE0 ) ;
glBindTexture ( GL_TEXTURE_2D , texture ) ;
glUniform1i ( glGetUniformLocation ( ourShader . Program , " ourTexture1 " ) , 0 ) ;
// Draw the triangle
ourShader . Use ( ) ;
glBindVertexArray ( VAO ) ;
glDrawElements ( GL_TRIANGLES , 6 , GL_UNSIGNED_INT , 0 ) ;
glBindVertexArray ( 0 ) ;
glFinish ( ) ;
glFinish ( ) ;
status = clEnqueueAcquireGLObjects ( commandQueue , 1 , & frontBuffer , 0 , 0 , 0 ) ;
status = clEnqueueNDRangeKernel ( commandQueue , compute_kernel , 1 , NULL , global_work_size , NULL , 0 , NULL , NULL ) ;
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 = 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 ) ;
status = clEnqueueReleaseGLObjects ( commandQueue , 1 , & frontBuffer , 0 , NULL , NULL ) ;
glFinish ( ) ;
clFinish ( commandQueue ) ;
// ======================================= Rendering Shtuff =================================================
// ======================================= Rendering Shtuff =================================================
@ -349,15 +362,7 @@ int main(int argc, char* argv[])
// Render
// Render
glActiveTexture ( GL_TEXTURE0 ) ;
glBindTexture ( GL_TEXTURE_2D , texture ) ;
glUniform1i ( glGetUniformLocation ( ourShader . Program , " ourTexture1 " ) , 0 ) ;
// Draw the triangle
ourShader . Use ( ) ;
glBindVertexArray ( VAO ) ;
glDrawElements ( GL_TRIANGLES , 6 , GL_UNSIGNED_INT , 0 ) ;
glBindVertexArray ( 0 ) ;
// Swap the screen buffers
// Swap the screen buffers
glfwSwapBuffers ( gl_window ) ;
glfwSwapBuffers ( gl_window ) ;