I am trying to build OpenCV 2.4.1 with OpenGL support, and it keeps faling. I have OpenGL installed in my Ubuntu 11.04, libs are under /usr/lib/libGL.so as usual. I know my
I have the same problem and I fund a solution by putting a extra command (WITH_QT=ON). I dont know why, but I found on the internet that is not possible enable OPENGL without enableing QT instead of GTK. I hope that this help us, and Iam sorry for my english (I dont know so much because I talk spanish).
Saludos compadres !! Desde Mexico :D
If OpenGL is installed:
apt-get install libgl1-mesa-dev libglu1-mesa-dev libqt4-opengl-dev
And still CMake cannot find OpenGL, then it means there is no libGl.so in /usr/lib/x86_64-linux-gnu/. If there is libGl.so in /usr/lib/x86_64-linux-gnu/mesa/, then this is a case of a missing softlink. Just reinstalling the packages should re-establish that link.
apt-get install --reinstall libgl1-mesa-dev libglu1-mesa-dev libqt4-opengl-dev
Please note that I had to install libqt4-opengl-dev
even though I did not care about Qt support in OpenCV or Qt support anywhere else. I am trying to figure out myself why a hefty 80MB or download and install was necessary to make the regular OpenGL work, but this method certainly works in Ubuntu 13.10.
You probably forgot to install the GTK+ OpenGL Extensions and their headers
sudo apt-get install libgtkglext1 libgtkglext1-dev
Run cmake with option:
cmake -DWITH_OPENGL=ON <your CMakeLists.txt directory>
or
cmake -DUSE_OPENGL=ON <your CMakeLists.txt directory>
cmake -D:WITH_OPENGL=ON
for Dan's comment. on openCV 2.4.6
I couldn't get the WITH_OPENGL flag to show up in my openCV 2.4.3 CMake options (I am running on a Mac - Snow Leopard 10.6.8)... I finally got it working by just opening up CMakeLists.txt and editing line 128 to:
OCV_OPTION(WITH_OPENGL "Include OpenGL support" ON)
Then run your CMake configurator/generator and it should build.