I want to interop Opencl and Opengl and my device have cl_khr_gl_sharing extention but when I create context has error CL_OUT_OF_RESOURCES
cl_uint num_platforms;
err = clGetPlatformIDs(1, NULL, &num_platforms);
if(err < 0) {
perror("Couldn't find any platforms.");
exit(1);
}
platforms = (cl_platform_id*)malloc(sizeof(cl_platform_id) * num_platforms);
clGetPlatformIDs(num_platforms, platforms, NULL);
cl_uint num_devices;
err = clGetDeviceIDs(platforms[0], CL_DEVICE_TYPE_GPU, 1, NULL, &num_devices);
if(err < 0) {
perror("Couldn't find any devices");
exit(1);
}
devices = (cl_device_id*)malloc(sizeof(cl_device_id) * num_devices);
err = clGetDeviceIDs(platforms[0], CL_DEVICE_TYPE_GPU,num_devices, devices, NULL);
if(err < 0) {
printf("clGetDeviceIDs %s",get_error_string(err));
system("pause");
//perror("Couldn't create a context");
//exit(1);
}
cl_context_properties props[] =
{
CL_GL_CONTEXT_KHR, (cl_context_properties)wglGetCurrentContext(),
CL_WGL_HDC_KHR, (cl_context_properties)wglGetCurrentDC(),
CL_CONTEXT_PLATFORM,(cl_context_properties)platforms[0],
0
};
context = clCreateContext(props, 1, &devices[0], NULL, NULL, &err);
if(err < 0) {
printf("//// %s",get_error_string(err));
system("pause");
//perror("Couldn't create a context");
//exit(1);
}
Does anybody have any suggestions?
Thank
Wijuk