在Windows上,OpenGL与DirectX有何不同? [英] On Windows, how does OpenGL differ from DirectX?

查看:100
本文介绍了在Windows上,OpenGL与DirectX有何不同?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我没有任何图形编程经验.在阅读有关图形编程的知识时,我对此表示怀疑.

I don't have any hands on experience with graphics programming. I got this doubt when I was reading about graphics programming.

据我了解,由于Windows不提供直接硬件访问之类的DOS,因此创建了DirectX.这意味着DirectX是实现直接(ish)硬件访问的唯一肯定的方法.我错了吗?

From what I understand, because Windows didn't offer DOS like direct hardware access, DirectX was created. That means DirectX is the only sure way to achieve direct(ish) hardware access. Am I wrong?

如果我没看错,那么必须使用DirectX本身或在DirectX之上实现OpenGL.

If I am not wrong, then OpenGL must be implemented either using DirectX itself or on top of DirectX.

那么这并不意味着在Windows OpenGL上确实是DirectX吗?

So doesn't it mean that on Windows OpenGL is really DirectX?

请注意,确切地说,我的疑问仅限于标题所说的内容,我不感兴趣为什么一个比另一个要好等等.

Please note that my doubt is restricted to what the title says, exactly, and I am not interested why is one better than the other etc.

推荐答案

据我了解,由于Windows不提供直接硬件访问之类的DOS,因此Direct X得以创建.

From what I understand, because Windows didn't offer DOS like direct hardware access, Direct X was created.

您是对的,Windows没有像直接硬件访问那样提供DOS.实际上,没有具有内存保护功能的操作系统.

You're right that Windows didn't offer DOS like direct hardware access. In fact no operating system with memory protection does.

是的,DirectX的创建是为了提供 a API,以加速对某些种类的硬件的访问. DirectX是 a 的API,用于加速硬件访问,而不是 THE (一个和唯一).

And yes, DirectX was created to offer a API for accelerated access to certain kinds of hardware. DirectX is a API for accelerated hardware access, not THE (one and only) one.

这意味着Direct X是实现直接(ish)硬件访问的唯一肯定的方法.我错了吗?

That means Direct X is the only sure way to achieve direct(ish) hardware access. Am I wrong?

是错误的,因为什么也没有人阻止您实施另一条加速硬件访问的轨道.负责引导对硬件的访问的软件称为驱动程序.驱动程序以特权模式运行,这意味着地址空间保护不适用于它们.也就是说,因为驱动程序必须能够与硬件通信.

You are wrong because nothing and nobody prevents you from implementing another track for accelerated hardware access. The pieces of software responsible for channeling access to hardware are called drivers. Drivers run in priviledged mode, which means, address space protection doesn't apply to them. That is, because drivers must be able to communicate with hardware.

驱动程序通过API与常规程序(即所谓的 User Space )进行通信. API可能是标准化的,然后可能被严格指定,或者可能完全是专有的.

Drivers communicate with regular programs, the so called User Space through APIs. APIs may be standardized, then may be tightly specified or they may be completely propritary.

DirectX是指定的API,该规范是由Microsoft编写的.

DirectX is a specified API, the specification was written down by Microsoft.

OpenGL是一种类似的API,但是它不是由单个实体指定的,而是以某种形式由多个贡献者协作标准化的.

OpenGL in a similar way is an API, but instead of having being specified by a single entity it's in some form standardized in collaboration of several contributors.

专有API的一个示例是3Dfx的Glide,这在很大程度上是受OpenGL启发的.实际上,有一个名为"minigl"的兼容性包装程序,实现了Half-Life 1引擎在3Dfx/Glide系统上工作所需的OpenGL子集.

One example for a propriatary API was Glide by 3Dfx, which in large parts was inspired by OpenGL. In fact there is a compatibility wrapper called "minigl" implementing the subset of OpenGL required for the Half-Life 1 engine to work on 3Dfx/Glide systems.

GPU供应商的驱动程序开发人员遵循API的规范,为DirectX,OpenGL或某些专有接口编写驱动程序.这些API中的每一个都可以访问驱动程序,从而可以访问硬件.单个资源可能有多个API.驱动程序可以并行实现DirectX 3D,OpenGL和其他任何东西,并将它们全部提供给用户空间.

The GPU vendors' driver developers follow the APIs' specifications, writing drivers for DirectX, OpenGL or some propriatary interface. Each of those APIs gives access to the driver and thus to the hardware. And there may be multiple APIs to a single resource. A driver may implement DirectX 3D, OpenGL and whatever else in parallel and provide them all to user space.

因此,如果附带GPU驱动程序,则OpenGL不会基于DirectX构建. Windows Vista及更高版本附带在DirectX之上构建的OpenGL-1.4仿真,但不支持着色器,顶点缓冲对象和所有其他哨声.一旦您安装了具有OpenGL支持的GPU驱动程序,这便将OpenGL-1.4仿真完全替换为实际的底层实现.

So no, OpenGL is not built on top of DirectX if shipping with a GPU driver. Windows Vista and above ship with a OpenGL-1.4 emulation built on top of DirectX, but that doesn't support shaders, vertex buffer objects and all the other whistles and bells. As soon as you install a GPU driver with OpenGL support, this completely replaces the OpenGL-1.4 emulation with an actual low-level implementation.

这篇关于在Windows上,OpenGL与DirectX有何不同?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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