Let's say I'm trying to display my webcam image in a game in DirectX11. I am using the prebuilt 3.1.0 libraries and I seem to be having difficulties with OpenCL while converting a Mat to a DirectX texture. I am using VS2013 Update 5 under Win10 and I am building a x64 windows application. The machine uses 2 x Nvidia Geforce GTX1080.
// CREATING DIRECTX TEXTURE
ID3D11Texture2D* myTexture = 0;
D3D11_TEXTURE2D_DEC desc_rgba;
desc_rgba.Width = 1024;
desc_rgba.Height = 768;
desc_rgba.MipLevels =1;
desc_rgba.ArraySize =1;
desc_rgba.Format = DXGI_FORMAT_R8G8B8A8_UNORM; // should be CV_8UC4
desc_rgba.SampleDesc.Count = 1;
desc_rgba.SampleDesc.Quality = 0;
desc_rgba.BindFlags = D3D11_BIND_SHADER_RESOURCE;
desc_rgba.Usage = D3D11_USAGE_DYNAMIC;
desc_rgba.CPUAccessFalgs = D3D11_CPU_ACCESS_WRITE;
desc_rgba.MiscFlags = 0;
HRESULT r = DIRECTX.Device->CreateTexture2D(&desc_rgba, 0, &myTexture);
if (FAILED(r)){
throw std::runtime_error("Can't create DX texture!");
}
//CV::MAT --> DIRECTX
bool enabledOpenCl = cv::ocl::haveOpenCL(); // Throws internal exception and returns 0
cv::Mat webCamImg = ...; // get valid image somehow
cv::Mat convertedImg;
cv::cvtColor(webCamImg, convertedImage, CV_BGR2BGRA); //CV_8UC3 -> CV_8UC4
cv::directx::convertToD3D11Texture2D(convertedImg, myTexture); // Throws exception!
Here's the cv::Exception::what():
C:\builds\master_PackSlave-win64-vc12-shared\opencv\modules\core\src\opencl\runtime\opencl_core.cpp:276: error (-220) OpenCL function is not available: [clGetPlatformIDs] in function opencl_check_fn
Here's the config log: http://pastebin.com/8i34sSRM
OpenCL is enabled in the config, but it's still not working. Any hints? Also, I don't jump to the code anymore when I get a cv::Exception(). What's up with that?