Binitha
Binitha

Reputation: 31

Opengl cl interop

I am using Nvidia 210/PCIe with Windows 7 OS. Opencl 1.0 , Opengl 3.3 and display driver 306.97. Can anyone pls assist me whether the above supports Opengl_cl interop and what toolkit should I download?

Upvotes: 0

Views: 287

Answers (1)

Pragmateek
Pragmateek

Reputation: 13354

  • To start developping OpenCL applications you need to get the NVidia SDK : https://developer.nvidia.com/cuda-toolkit

  • You can check for OpenCL/OpenGL interop capabilities by scanning supported extensions looking for "cl_khr_gl_sharing" :

.

#include <iostream>
#include <CL/cl.hpp>

int main()
{
    std::vector<cl::Platform> platforms;
    cl::Platform::get(&platforms);

    std::vector<cl::Device> devices;
    platforms[0].getDevices(CL_DEVICE_TYPE_ALL, &devices);

    for (int i = 0; i < devices.size(); ++i)
    {
        std::string name = devices[i].getInfo<CL_DEVICE_NAME>();
        std::string extensions = devices[i].getInfo<CL_DEVICE_EXTENSIONS>();

        std::cout << name
                  << std::endl
                  << "OpenGL interop supported : "
                  << (extensions.find("cl_khr_gl_sharing") != std::string::npos ? "YES" : "NO")
                  << std::endl;
    }

    return 0;
}

Upvotes: 1

Related Questions