AnsweredAssumed Answered

OpenCL C++ wrapper

Question asked by sajis997 on Mar 15, 2013
Latest reply on Apr 30, 2013 by himanshu.gautam

Hi forum

 

I am using the C++ wrapper for the opencl and opengl interoperability. In that case i have to define the properties as follows:

 

 

try

{

      std::vector<cl::Platform> platformList;

      std::vector<cl::Kernel> allKernels;

     

      // Pick platform

      cl::Platform::get(&platformList);

 

 

     

      // Pick first platform

      cl_context_properties cprops[] =

           {

              CL_GL_CONTEXT_KHR, (cl_context_properties)glXGetCurrentContext(),

              CL_GLX_DISPLAY_KHR, (cl_context_properties)glXGetCurrentDisplay(),             

              CL_CONTEXT_PLATFORM, (cl_context_properties)(platformList[0])(),

              0

           };

     

      cl::Context context(CL_DEVICE_TYPE_GPU, cprops);

.........................

..........................

 

}

catch(...)

{

 

}

 

 

It compiles fine, but while runnning it i get the following error:

 

clCreateContextFromType: Error code -2

 

 

Does it mean that it failed to create context by type?

 

 

How to get around this problem?

 

 

 

Regards

Sajjad

Outcomes