VirtualBox 上的 Qt + VTK +Ubuntu

Qt + VTK +Ubuntu on VirtualBox

我需要在 Ubuntu 上 运行 一个带有 VTK 的 Qt 项目并且我正在使用 VirtualBox,但是我有一个错误:

GL version 2.1 with the gpu_shader4 extension is not supported by your graphics driver but is required for the new OpenGL rendering backend. Please update your OpenGL driver. If you are using Mesa please make sure you have version 10.6.5 or later and make sure your driver in Mesa supports OpenGL 3.2.

最新版本的 VTK 默认使用 new rendering backend。在用于配置您的构建的 CMake 缓存文件中,相应的 cmake 变量 VTK_RENDERING_BACKEND 具有值 "OpenGL2",它假定最低 OpenGL API 版本为 2.1。但问题是 VirtualBox 的原始安装默认情况下不授予对 3D 加速的访问权限,因为它可能无法从主机系统推断出这些信息。

所以我认为根据您的需要和限制,您在这里有多种选择,您可以安装 VirtualBox Guest Additions 以启用 hardware 3D acceleration, allow access to a newer version of the OpenGL API and use in the end the host to performs the requested 3D operations. You could also use a recent version of the Mesa3D library to performs the needed 3D operations on the CPU (to choose preferably if you don't have graphics hardware on the host). For a presentation of its features, you can take a look here