Linux - 默认 OpenGL 版本

Linux - default OpenGL version

我在 Ubuntu 18.04 工作。我没有定义 GL_GLEXT_PROTOTYPES。我使用 glXGetProcAddress 加载“核心”OpenGL 函数。我的申请链接到 /usr/lib/x86_64-linux-gnu/libGL.so。一些旧版 OpenGL 函数无需定义 GL_GLEXT_PROTOTYPES 或调用 glXGetProcAddress 即可使用,例如 glColor3f。 Linux 下默认提供哪个 OpenGL 版本(功能)?

编辑

我假设硬件支持最新的 OpenGL 版本。此外,我使用来自标准 Ubuntu 位置的兼容性配置文件和 OpenGL headers (gl.h, glext.h):/usr/include/GL。看起来那些 headers 已经被 mesa-common-dev apt 包安装了。

传统上,Linux 上的 libGL.so 由图形驱动程序供应商提供。没有真正的“默认”版本。在这方面,您可以找到的最接近标准的是 OpenGL® Application Binary Interface for Linux,它指出:

3.4. The libraries must export all OpenGL 1.2, GLU 1.3, GLX 1.3, and ARB_multitexture entry points statically.

4.5. All OpenGL 1.2 and ARB_multitexture, GLU 1.3, and GLX 1.3 entry points and enumerants must be present in the corresponding header files gl.h, glu.h, and glx.h, even if only OpenGL 1.1 is implemented at runtime by the associated runtime libraries.

这基本上就是您可以依赖的直接导出的 GL 函数集。通常,各种供应商的 GL 库导出更多,但您查询事物的官方方式是扩展机制。

请注意,在 Linux 上,使用 OpenGL 的现代方法是通过 vendor-neutral GL dispatch library,它提供 libOpenGL.so 而不是 libGL.so。它似乎导出了构建时已知的所有核心 OpenGL 函数。但这并不意味着特定的供应商实现将支持所有这些功能。