什么是 OpenGL 作为计算机文件 [英] What is OpenGL as a computer file

查看:55
本文介绍了什么是 OpenGL 作为计算机文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

好的,我知道网上有数百万个关于 OpenGL 是什么的答案,但我试图找出我计算机上的文件是什么.我研究并发现 OpenGL 充当不同计算机图形卡的多平台转换器.那么,它是一个dll吗?
我想知道,如果它是一个dll,那么我不能下载任何版本的dll(最好是最新的),然后使用它,知道它有什么吗?

Ok, I know that online there are millions of answers to what OpenGL is, but I'm trying to figure out what it is in terms of a file on my computer. I've researched and found that OpenGL acts as a multi-platform translator for different computer graphics cards. So, then, is it a dll?
I was wondering, if it's a dll, then couldn't I download any version of the dll (preferably the latest), and then use it, knowing what it has?

好的,所以如果它是一个 Windows dll,并且我制作了一个使用最新版本的 OpenGL 游戏,如果其他人的早期版本的计算机不支持它怎么办?我可以在我的游戏中携带 dll 以便在其他 Windows 计算机上支持它吗?还是在特定计算机上严格设置了与显卡通信的 dll?

Ok, so if it's a windows dll, and I make an OpenGL game that uses a late version, what if it's not supported on someone else's computer with an earlier version? Am I allowed to carry the dll with my game so that it's supported on other windows computers? Or is the dll set up to communicate with the graphics card strictly on specific computers?

OpenGL 一直在更新(不管它是什么).如果它所做的只是与一堆不同计算机上的图形卡通信,这些计算机的图形卡自从内置以来就永远不会更新,那么如何做到这一点?

OpenGL is constantly being updated (whatever it is). How can this be done if all it's doing is communicating with a graphics card on a bunch of different computers that have graphics cards that are never going to be updated since they're built in?

推荐答案

OpenGL 有两个部分"——Khronos Group 每隔几个月更新一次的规范,以及由您的显卡制造商专门编写的驱动程序适用于您的显卡型号.

There are two "parts" to OpenGL - the specification that's updated by the Khronos Group once every few months, and the driver that's written by your graphics card manufacturer specifically for your graphics card model.

OpenGL 规范本质上详细说明了有关 OpenGL API 的所有内容应该如何工作 - 预期行为应该是什么,何时将某些行为视为意外行为,何时抛出哪些错误等.该规范让驱动程序编写者确切地知道他们需要什么要做并让应用程序编写者知道对驱动程序的期望.这就是 OpenGL 真正的本质"——将应用程序和驱动程序结合在一起的粘合剂.您可以在此处阅读每个版本的所有规范.

The OpenGL specification essentially details how everything about the OpenGL API should work - what the expected behavior should be, when something is considered unexpected behavior, when to throw which errors, etc. The specification lets the driver writers know exactly what they need to do and lets application writers know what to expect from a driver. This is what OpenGL really "is" - the glue that holds applications and drivers together. You can read all the specifications for each version here.

然后是实现 OpenGL API 并被认为符合规范的驱动程序.驱动程序完全按照您的预期执行 - 将数据复制到显卡的内存和从显卡的内存中复制数据,将数据写入显卡寄存器,跟踪状态,处理顶点,编译着色器,指示数百个流处理器同时转换顶点和填充像素等.如果没有 OpenGL,每个显卡模型都会有一个单独的、稍微快一点的 API,由于它的结构方式,它只能用于那个显卡.使用 OpenGL,驱动程序都是针对相同的 API 编写的,并且应用程序的代码将在所有显卡上运行.

Then there's drivers that implement the OpenGL API and are considered compliant to the specification. The driver does exactly what you'd expect it to do - copy data to and from the graphics card's memory, write data to graphics card registers, keep track of state, process vertices, compile shaders, instruct hundreds of stream processors to simultaneously transform vertices and fill pixels, etc. Without OpenGL, each graphics card model would have a separate, slightly faster API that would only work for that one graphics card because of the way it was structured. With OpenGL, the drivers are all written against the same API and an application's code will run on all graphics cards.

对 OpenGL 规范的遵守不会随着驱动程序更新而改变.大多数驱动程序更新将修复小错误或进行一些内部优化.

Compliance to the OpenGL specification doesn't change with driver updates. Most driver updates will either fix minor bugs or do some internal optimizing.

我曾经知道 ATI 驱动程序存在一个小错误,您必须调用 glEnable(GL_TEXTURE_2D); 才能以 OpenGL 3 方式生成 mipmap (glGenerateMipMaps()) 尽管 GL_TEXTURE_2D 作为 glEnable() 的可能值被弃用.我不确定它现在是否已修复,但这肯定是驱动程序编写者很容易忽略的边缘情况类型.

I know at one point there was a small bug with ATI driver where you had to call glEnable(GL_TEXTURE_2D); before you could generate mipmaps the OpenGL 3 way (glGenerateMipMaps()) despite GL_TEXTURE_2D being deprecated as a possible value for glEnable(). I'm not sure if it's fixed now, but it's certainly the type of edge case that can easily be overlooked by driver writers.

至于优化,还有很多需要优化.也许有另一种方法可以在编译时优化着色器,也许有一种更有效的方法可以在流处理器之间分配工作,我不知道.

As for optimizations, there's a lot to optimize. Maybe there's another way to optimize shaders when they're being compiled, maybe there's a more efficient way to distribute work between the stream processors, I don't know.

这篇关于什么是 OpenGL 作为计算机文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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