Hello forum

i am trying the enable the opengl interoperability with opencl. But i have having problem creating the context. I initially set the following context properties:

Code :
   cl_context_properties cps[] =
      {
	 CL_GL_CONTEXT_KHR, (cl_context_properties)glXGetCurrentContext(), 
	 CL_GLX_DISPLAY_KHR, (cl_context_properties)glXGetCurrentDisplay(),       
	 CL_CONTEXT_PLATFORM, (cl_context_properties)platform,	
	 0
      };
 
   cl_context_properties *cprops = (NULL == platform) ? NULL : cps;
 
   //create the opencl context
   context = clCreateContext(
      cprops,
      1,
      &selectedDevice,
      NULL,
      NULL,
      &status);


But when i run the code i get the following output:

Code :
OpenCL Platform 0: NVIDIA Corporation
OpenCL Device 0: Type = TYPE_GPU
OpenCL Device 0: Name = GeForce GTX 560M
OpenCL Device 0: Compute units = 4
OpenCL Device 0: Max. work group size = 1024
Failed to open OpenCL context

But if i comment the following properties it creates the context:

Code :
CL_GL_CONTEXT_KHR, (cl_context_properties)glXGetCurrentContext()


Any idea?

Please let me know if you need more information.


Regards
Sajjad