How to compile/run sample programs, specifically opengl_interop
I complied using this:
g++ -ggdb opengl_interop.cpp -o opengl_interop `pkg-config --cflags --libs opencv` -lGL -lGLU -lX11
and then run
./opengl_interop -c
result
Usage: opengl_interop [params]
-c, --camera (value:true)
use camera or not
-f, --file
movie file name
-h, --help (value:false)
print help info
[ INFO:0] Initialize OpenCL runtime...
OpenCV(3.4.1) Error: Unknown error code -222 (OpenCL: Can't create context for OpenGL interop) in initializeContextFromGL, file /OpenCV/modules/core/src/opengl.cpp, line 1683 Exception: OpenCV(3.4.1) /OpenCV/modules/core/src/opengl.cpp:1683: error: (-222) OpenCL: Can't create context for OpenGL interop in function initializeContextFromGL
I've tried a few other programs that require the same interoperability and I'm not able to get them to work either.
I started debugging the opengl.cpp file and
fails at this line:
This line is not successful, so the next if statement if(status != CL_SUCCESS) causes the function to exit the for loop it is in and the cl context is never created and leads to:
I believe maybe there is a difference between
and
The OpenCV code looks for platform. Which when I look in the clinfo list, I do not have "cl_khr_gl_sharing" listed for my platform. Whereas maybe it should look for the device info, because I have that extension listed for my device extensions.
This line is what I am wondering about: