Implementing Interoperation
To use the Interoperation function we need to include the cl_gl.h
header file. This header contains declaration of the required function for interoperation.
Detecting if OpenCL-OpenGL Interoperation is supported
Before discussing other implementation steps, we try to detect whether the current environment supports this interoperation. We use the OpenCL API clGetDeviceInfo(…)
for this purpose. The first call would get the total size needed to store the string (char*
) returned by the second call. This string is a list of all the device extensions that are supported by the current environment. We then try to find from this list, whether it has an item called cl_khr_gl_sharing
for Windows and Linux and cl_apple_gl_sharing ...
Get OpenCL Programming by Example now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.