What are the differences between DirectX and OpenGL?
Firstly let me say that both are very useful to know. DirectX is a collection of APIs including APIs for graphics, music, audio, input, networking and multimedia. OpenGL is dedicated to graphics. So to compare the two makes no sense, we can however (tentatively) compare OpenGL with Direct3D:
- Most people find OpenGL easier to learn to start with
- OpenGL uses standard C interfaces.
- Direct3D has a steeper initial learning curve and is based on C++ interfaces (COM).
- It is more difficult using OpenGL to do lower level operations than Direct3D, however this does mean you are less likely to crash an OpenGL app than a Direct3D one.
- The vast majority of PC games are written using Direct3D.
- OpenGL can run on multiple platforms where as Direct3D is Windows based.
- Direct3D is updated frequently (every 2 months), allowing a standard interface to new features sooner than they appear in core OpenGL. However, OpenGL has an extension mechanism allowing immediate access to new features as graphics manufacturers create them, rather than having to wait for a new API version to appear.
- Direct3D has a lot of helper functions for common game coding issues (the D3DX set of functions)
- In terms of performance there is little difference between the two.
As you can see there are pros and cons for each and really you should just learn both and use whichever is appropriate. You could even, if you wish, use OpenGL for graphics and the other APIs of DirectX for input, networking etc. If you are looking for a career in the games industry I would advise you to learn DirectX.
OpenGL和DirectX有什么区别?
首先就我所知,他们都是很有用的,DirectX是一系列的API,包括图形,音乐,音效,输入,网络和多媒体.OpenGL是图形专用的,因此将它们做比较是没有意义的,但是我们还是可以将两者进行比较.
很多人会发现OpenGL学起来容易上手
OpenGL使用标准的C接口
DirectX的学习曲线非常大而且它是基于C++接口(COM)
对于低级的操作,OpenGL比DirectX更难,但是这不意味这你喜欢DirectX多过OpenGL
大多数的PC游戏都是用DirectX制作
OpenGL可以运行在多平台,而DirectX只能在windows平台下运行
DirectX的更新速度非常的快(几乎两个月一次),但是OpenGL拥有扩展机制,能够使制造商更新它们,这比等着一个新的版本出现要好些
DirectX拥有许多辅助函数来进行游戏编码
在性能方面它们之间的差别不大
正如你所看到的,它们都有利有弊.你可以两者都学习,这样可以在合适的时候使用它们,如果你愿意,你甚至可以在图形上使用OpenGL,在其他的地方,比如输入,网络等等使用DirectX,如果你想在游戏领域需求一条道路,我建议你学习DirectX
(e文水平不行,有错误的地方希望大侠指正!)