I need to use OpenGL in my code. I am using CMake in order to search opengl in my system like this :
find_package(OpenGL REQUIRED)
It returns this error :
CMake Error at /usr/share/cmake-3.10/Modules/FindPackageHandleStandardArgs.cmake:137 (message):
Could NOT find OpenGL (missing: OPENGL_opengl_LIBRARY OPENGL_glx_LIBRARY
OPENGL_INCLUDE_DIR)
Call Stack (most recent call first):
/usr/share/cmake-3.10/Modules/FindPackageHandleStandardArgs.cmake:378 (_FPHSA_FAILURE_MESSAGE)
/usr/share/cmake-3.10/Modules/FindOpenGL.cmake:369 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
CMakeLists.txt:8 (find_package)
-- Configuring incomplete, errors occurred!
See also "/home/kapil/Documents/OpenGLZero/build/CMakeFiles/CMakeOutput.log".
I have installed nvidia-drivers-418 (not the headless ones). It shows all the opengl information here:
Nvidia driver has libnvidia-gl-418
package in it, and to me it seems it should provide me with the opengl capabilities. Here is the output of dpkg -l libnvidia-gl-418
:
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Architecture Description
+++-==================================-======================-======================-==========================================================================
ii libnvidia-gl-418:amd64 418.56-0ubuntu0~gpu18. amd64 NVIDIA OpenGL/GLX/EGL/GLES GLVND libraries and Vulkan ICD
ii libnvidia-gl-418:i386 418.56-0ubuntu0~gpu18. i386 NVIDIA OpenGL/GLX/EGL/GLES GLVND libraries and Vulkan ICD
and dpkg -L libnvidia-gl-418
:
/usr/lib/x86_64-linux-gnu/libEGL_nvidia.so.418.56
/usr/lib/x86_64-linux-gnu/libGLESv1_CM_nvidia.so.418.56
/usr/lib/x86_64-linux-gnu/libGLESv2_nvidia.so.418.56
/usr/lib/x86_64-linux-gnu/libGLX_nvidia.so.418.56
/usr/lib/x86_64-linux-gnu/libnvidia-cbl.so.418.56
/usr/lib/x86_64-linux-gnu/libnvidia-eglcore.so.418.56
/usr/lib/x86_64-linux-gnu/libnvidia-glcore.so.418.56
/usr/lib/x86_64-linux-gnu/libnvidia-glsi.so.418.56
/usr/lib/x86_64-linux-gnu/libnvidia-glvkspirv.so.418.56
/usr/lib/x86_64-linux-gnu/libnvidia-rtcore.so.418.56
/usr/lib/x86_64-linux-gnu/libnvidia-tls.so.418.56
/usr/lib/x86_64-linux-gnu/libnvoptix.so.418.56
/usr/lib/x86_64-linux-gnu/nvidia-418
/usr/lib/x86_64-linux-gnu/nvidia-418/xorg
/usr/lib/x86_64-linux-gnu/nvidia-418/xorg/libglxserver_nvidia.so.418.56
/usr/share
/usr/share/doc
/usr/share/doc/libnvidia-gl-418
/usr/share/doc/libnvidia-gl-418/changelog.Debian.gz
/usr/share/doc/libnvidia-gl-418/copyright
/usr/share/glvnd
/usr/share/glvnd/egl_vendor.d
/usr/share/glvnd/egl_vendor.d/10_nvidia.json
/usr/share/vulkan
/usr/share/vulkan/icd.d
/usr/share/vulkan/icd.d/nvidia_icd.json
/usr/lib/x86_64-linux-gnu/libEGL_nvidia.so.0
/usr/lib/x86_64-linux-gnu/libGLESv1_CM_nvidia.so.1
/usr/lib/x86_64-linux-gnu/libGLESv2_nvidia.so.2
/usr/lib/x86_64-linux-gnu/libGLX_nvidia.so.0
/usr/lib/x86_64-linux-gnu/libnvoptix.so.1
/usr/lib/x86_64-linux-gnu/nvidia-418/xorg/libglxserver_nvidia.so
Last time, I had to install mesa-utils
(for glxinfo) and libgl1-mesa-dev
to use opengl. I want to know if nvidia drivers are of any use for opengl or I should have installed headless drivers instead? (How) Can I use opengl installed in nvidia? Thank you.
First and foremost: Don't mess with any symlinks or libraries installed on your system by the package manager or the NVidia driver installer! If you did, you better return it to the state you found things.
So what's missing are the OpenGL headers, not the libraries . Those use(d) to come with the NVidia driver installer, but if you use your systems package manager, they will be split into a different package.
Technically you could just copy the headers from the OpenGL registry into your project. But usually folks go with installing the default system package that ships the headers.
In case of Debian and Ubuntu that'd be the mesa-common-dev
package. Never mind that it's the Mesa package, the headers are the same (functionally).
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.