interoperability OpenCL/OpenGL under Linux getting context from OpenGL under Linux

Hi,

I’m currently trying to make work the interoperability OpenGL/OpenCL in the NVidia sample (for example oclPostProcess) with the 195 drivers but I can’t get the context from OpenGL. I found on this post the solution for windows : http://forums.nvidia.com/index.php?showtopic=149937 :

cl_int			 cl_error;

	cl_device_id device_id;

	cl_context_properties akProperties[] =

	{

		CL_GL_CONTEXT_KHR, (cl_context_properties)wglGetCurrentContext(),

		CL_WGL_HDC_KHR, (cl_context_properties)wglGetCurrentDC(), 0

	};

	cl_error = clGetDeviceIDs(NULL, CL_DEVICE_TYPE_GPU, 1, &device_id, NULL);

		if(cl_error!=CL_SUCCESS)

		  abort();

	cl_contenct ctx=clCreateContext(akProperties,

					1,

					&device_id		  /* devices */,

					NULL,

					NULL,

					&cl_error);

		if(cl_error!=CL_SUCCESS)

		  abort();

But my problem is that I can’t find the equivalent functions of wglGetCurrentContext() and wglGetCurrentDC() under Linux. Does somebody know how to get the Current Context and the current Device Context under linux?

Thanks in advance for you answer :)

The oclSimpleGL SDK example has been updated for OpenGL/OpenCL interoperability on all platforms (search for #ifdef UNIX) in the latest beta.

Thank youfor your answer. I hadn’t looked at the oclSimpleGL just the oclPostprocessGL. Now it seems to work.