什么时候需要使用 OpenGL 函数加载器? [英] When do I need to use an OpenGL function loader?

查看:31
本文介绍了什么时候需要使用 OpenGL 函数加载器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对什么时候需要使用像 GLEW 这样的 OpenGL 函数加载器有点困惑.一般来说,您似乎首先获得一个窗口和有效的 OpenGL 上下文,然后尝试加载函数.

I'm a bit confused about when exactly I need to use an OpenGL function loader like GLEW. In general, it seems like you first obtain a window and valid OpenGL context and then attempt to load functions.

  • 有时这些功能被称为扩展,有时也被称为核心功能.似乎加载并归类为核心"和扩展"的内容取决于平台.除了一些基本集之外,还加载了哪些函数?

  • Sometimes these functions are referred to as extensions, sometimes they are called core functions as well. It seems like what's loaded and classified as 'core' and 'extension' is platform dependent. Are the functions that are loaded in addition to some base set?

您是否也需要在 OpenGL ES 平台上以相同的方式加载函数?快速浏览一下 GLEW,我没有看到对 Open GL ES 的任何明确支持.然而,其他 GL 函数加载器库确实明确提到了对 ES 的支持(例如 https://github.com/Dav1dde/glad)

Do you need to load functions in the same way on OpenGL ES platforms as well? Taking a quick look at GLEW, I don't see any explicit support for Open GL ES. Other GL function loader libs do explicitly mention support specifically for ES however (like https://github.com/Dav1dde/glad)

推荐答案

OpenGL 函数(核心或扩展)必须在运行时动态加载,只要有问题的函数不是平台原始 OpenGL ABI(应用程序二进制界面).

OpenGL functions (core or extension) must be loaded at runtime, dynamically, whenever the function in question is not part of the platforms original OpenGL ABI (application binary interface).

  • 对于 Windows,ABI 涵盖的是 OpenGL-1.1
  • 对于 Linux,ABI 涵盖 OpenGL-1.2(其他 *nix 没有官方的 OpenGL ABI,但它们通常也需要 OpenGL-1.2)
  • 对于 MacOS X,可用的 OpenGL 版本及其 ABI 由操作系统版本定义.

这导致了以下规则:

  • 在 Windows 中,除了单纹理、无着色器、固定函数绘图外,几乎所有东西都需要一个函数加载器;可能可以加载更多功能,但这不是给定的.
  • 在 Linux 中,除了基本的多纹理和基本的 texenv 模式、无着色器、固定函数绘图外,几乎所有东西都需要一个函数加载器;可能可以加载更多功能,但这不是给定的.
  • 在 MacOS X 中,您根本不需要函数加载器,但是您可以使用的 OpenGL 功能严格由操作系统版本决定,您要么拥有,要么没有.
  • In Windows you're going to need a function loader for pretty much everything, except single textured, shaderless, fixed function drawing; it may be possible to load further functionality, but this is not a given.
  • In Linux you're going to need a function loader for pretty much everything, except basic multitextured with just the basic texenv modes, shaderless, fixed function drawing; it may be possible to load further functionality, but this is not a given.
  • In MacOS X you don't need a function loader at all, but the OpenGL features you can use are strictly determined by the OS version, either you have it, or you don't.

核心 OpenGL 功能和扩展之间的区别在于,核心功能可在 OpenGL 规范中找到,而扩展是除了可用的 OpenGL 版本所提供的功能之外,可能还可能不可用的功能.

The difference between core OpenGL functions and extensions is, that core functions are found in the OpenGL specification, while extensions are functionality that may or may be not available in addition to what the OpenGL version available provides.

扩展和更新版本的核心功能都是通过相同的机制加载的.

Both extensions and newer version core functions are loaded through the same mechanism.

这篇关于什么时候需要使用 OpenGL 函数加载器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆