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

查看:155
本文介绍了什么时候需要使用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 ABI(应用程序 > binary 界面).

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由OS版本定义.

这导致以下规则:

  • 在Windows中,除了单一纹理,无着色器,固定功能图之外,几乎所有功能都需要一个功能加载器;可能可以加载更多功能,但这不是给定的.
  • 在Linux中,几乎所有功能都需要一个函数加载器,除了基本的多纹理,仅具有基本的texenv模式,无着色器,固定的函数绘制;可能可以加载更多功能,但这不是给定的.
  • 在MacOS X中,您根本不需要功能加载器,但是您可以使用的OpenGL功能完全由OS版本决定,无论您是否拥有它.

核心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天全站免登陆