[3D image programming] DirectX vs OpenGL

Source: Internet
Author: User

The first question of 3D programming is what API: OpenGL or direct3d? Some of their comparisons are as follows:

1 operating system platform:
If your operating system is Windows, you can choose. If it is Unix or Linux, OpenGL can only be used.

2 ease of use:
OpenGL is relatively easier to learn than DirectX and can get started quickly (this is widely accepted ). Even if you may want to use direct3d in the future, OpenGL is still a good way to get started with 3D programming. The original 3D functions in OpenGL are similar to the pseudo functions in most computer graphics textbooks. Code Exactly.

3 Documentation Support:
On the Internet, you can find a lot of good OpenGL documents, tutorials, routines, and so on, especially the "Red Book" (related links and documents can be found in the OpenGL column on this site ). However, the documents provided by the DirectX SDK are much more difficult to chew (accepted ), you cannot find a good tutorial on the Internet (almost all the Chinese documents that can be found in the DirectX section on this site are not repeated ). In addition, there are a lot of OpenGL documents in the bookstore, while DirectX only has one kind of "desired" and is not about direct3d.

4 about com:
DirectX is based on COM, but OpenGL is not. If you are not so popular with COM, you 'd better choose OpenGL first. However, if you are always doing 3D programming on Windows, you should always be familiar with direct3d, because a new 3D interface developed jointly by Microsoft, SGI, and HP is based on COM, it will be closer to direct3d.

5 Portability:
DirectX is closely connected to Windows, making it difficult to transplant. While OpenGL is a very "clean" API, from the VB language to the VC language, or from the Windows platform to the Linux platform (almost the same C code) is very easy (and provides platform-independent window management libraries in GLUT ).

6. Multimedia performance:
Because DirectX includes directsound, directinput, and so on, if direct3d is used with them, it will be easier to control the sound and joystick, which is the overall advantage of DirectX. Of course, no one is opposed to using OpenGL and directsound at the same time. Quake does this.

7 speed:
It is hard to say which one is faster. Quake uses the OpenGL engine, while unreal uses direct3d, which are all very famous. In fact, Program The speed does not depend on the quality of the code you write (depending on your familiarity with the interfaces you use) Because you have chosen OpenGL or DirectX ), hardware support (including hardware driver support ).

8 Robustness:
In this case, when an error occurs in OpenGL calling, it does nothing. When DirectX makes an error, it does everything ......

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.