OpenSceneGraph Forum Forum Index OpenSceneGraph Forum
Official forum which mirrors the existent OSG mailing lists. Messages posted here are forwarded to the mailing list and vice versa.
 
   FAQFAQ    SearchSearch    MemberlistMemberlist    RulesRules    UsergroupsUsergroups    RegisterRegister 
 Mail2Forum SettingsMail2Forum Settings  ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
   AlbumAlbum  OpenSceneGraph IRC ChatOpenSceneGraph IRC Chat   SmartFeedSmartFeed 

OpenGL sync object and OSG


 
Post new topic   Reply to topic    OpenSceneGraph Forum Forum Index -> osgCompute [osgCompute]
View previous topic :: View next topic  
Author Message
sajis997
User


Joined: 28 Nov 2010
Posts: 87

PostPosted: Thu Jul 11, 2013 7:03 am    Post subject:
OpenGL sync object and OSG
Reply with quote

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
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    OpenSceneGraph Forum Forum Index -> osgCompute [osgCompute] All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum

Similar Topics
Topic Author Forum Replies Posted
No new posts OpenGL Mottaghi, Arman General 1 Sun Jul 09, 2017 11:28 pm View latest post
No new posts OpenGL warning qiaokun General 1 Thu May 25, 2017 2:57 am View latest post
No new posts draw primitive sets and geometry shad... wernerM General 0 Wed May 24, 2017 3:20 pm View latest post
No new posts OpenGL error when using TextureBuffer MariusD General 1 Mon May 22, 2017 1:40 pm View latest post
No new posts scene object not receiving/casting sh... Meldryt General 0 Thu May 11, 2017 8:01 am View latest post


Board Security Anti Bot Question MOD - phpBB MOD against Spam Bots
Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP