Skip to content

Instantly share code, notes, and snippets.

@fkaa
Created August 31, 2014 06:53
Show Gist options
  • Save fkaa/5a8a6610c128e98b568c to your computer and use it in GitHub Desktop.
Save fkaa/5a8a6610c128e98b568c to your computer and use it in GitHub Desktop.
#ifdef __APPLE__
CGLContextObj kCGLContext = CGLGetCurrentContext();
CGLShareGroupObj kCGLShareGroup = CGLGetShareGroup(kCGLContext);
cl_context_properties prop[] = {
CL_CONTEXT_PROPERTY_USE_CGL_SHAREGROUP_APPLE, (cl_context_properties)kCGLShareGroup,
CL_CONTEXT_PLATFORM, (cl_context_properties)platform,
0
};
#elif __WIN32
cl_context_properties prop[] = {
CL_GL_CONTEXT_KHR, (cl_context_properties)wglGetCurrentContext(),
CL_WGL_HDC_KHR, (cl_context_properties)wglGetCurrentContext(),
CL_CONTEXT_PLATFORM, (cl_context_properties)platform,
0
};
#elif __linux__
cl_context_properties prop[] = {
CL_GL_CONTEXT_KHR, (cl_context_properties)glXGetCurrentContext(),
CL_GLX_DISPLAY_KHR, (cl_context_properties)glXGetCurrentDisplay(),
CL_CONTEXT_PLATFORM, (cl_context_properties)(platforms[0])(),
0
};
#else
Log::e("No support for this platform, sorry!");
#endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment