Hi forum, To Synchronize the data transfer between the GPU(OpenCL) and CPU i need to use the OpenGL Sync object. If i have to code in OpenGL , the snippet could be laid out as follows:
Code: cl_event release_event; cl_int errNum; //OpenGL fence object is created. This creates and inserts a fence sync into //OpenGL command stream GLSync sync = glFenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE,0); //The following command creates an OpenCL event linked to the fence. The OpenCL //event is then used in the event list for clEnqueueAcquireGLObjects(), ensuring that //the acquire call will proceed only after the fence has completed. cl_event gl_event = clCreateEventFromGLsyncKHR(context,sync,NULL); errNum = clEnqueueAcquireGLObjects(commandQueue,1,&cl_tex_mem,0,&gl_event,NULL); //Several other OpenCL commands go on here - mainly kernel execution that will //be handled by the computation node //The following command will return an event object and stored in the release_event. //It can be used to sync upon its completion errNum = clEnqueueReleaseGLObjects(commandQueue,1,&cl_tex_mem,0,NULL,&release_event); //creates the OpenGL sync object linked to the release_event GLsync cl_sync = glCreateSyncFromCLeventARB(context, release_event,0); //a wait is inserted into the OpenGL command stream //that will wait upon the completion of the release_event associated with the clEnqueueReleaseGLObjects(). glWaitSync(cl_sync,0, GL_TIMEOUT_IGNORED); Please Avoid the OpenCL references if it does not make any sense to you. I need some hint on how the gl commands will be distributed in pre and post draw callbacks. Should i create two separate classes that deals with the pre draw callback and post draw callback or just post draw callback will be enough? Best Regards Sajjadul ------------------ Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=55196#55196 _______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

