Install all the necessary packages. GCC etc. Install OpenCV from sources. (Set OPENCV_DIR env variable for cmake to find your installation). Install Cmake from sources with WITH_OPENGL=ON