O'Reilly logo

OpenCL Programming by Example by Koushik Bhattacharyya, Ravishekhar Banger

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required