OpenGL and DirectX

Preface

Learning 3D game development cannot avoid dealing with graphics. When installing some large games on a computer, it is often reported that something is missing, which leads to the game being unable to run. The word that appears in it is DirectX, but what is it? What is OpenGL ?

Who deals with realistic game scenes and special effects in Unity3D game development? Let's start learning about OpenGL and DirectX!

What is OpenGL

OpenGL (Fully Written Open Graphics Library) is a professional graphical programming interface that defines a cross programming language and cross platform programming interface specification. It is used for 3D images (2D can also be used) and is a powerful and easily accessible underlying graphics library.

OpenGL is a hardware independent software interface that can be used on different platforms such as
Windows 95, Windows
Porting between NT, Unix, Linux, MacOS, and OS/2. Therefore, software that supports OpenGL has good portability and can be widely applied. Due to
OpenGL is the underlying graphics library that does not provide geometric entity primitives and cannot be directly used to describe scenes. However, through some conversion programs, it is easy to convert AutoCAD [2]
Convert DXF and 3DS model files produced by 3D graphic design software such as 3DS/3DSMAX [3] into vertex arrays in OpenGL.

Market research firm Jon Peddie Research predicts that the installation scale of OpenGL 3.1 standard graphics hardware will exceed 100 million. The graphics card drivers for AMD, NVIDIA, and S3 Graphics currently support OpenGL 3.0.

What is OpenGL-ES

OpenGL ES (OpenGL for Embedded Systems) is a subset of the OpenGL 3D graphics API designed for embedded devices such as smartphones, PDAs, and game consoles.

OpenGL ES
It is a free, cross platform, and fully functional 2D and 3D graphics application program interface API designed specifically for various embedded systems -
Including consoles, mobile phones, handheld devices, home appliances, and cars. It is composed of a carefully defined subset of desktop OpenGL, creating a flexible and powerful underlying interaction interface between software and graphics acceleration, which is currently available on hand The main graphics underlying support used in machine games.

What is DirectX

From 1995 to 1996, Microsoft implemented a new plan to support
The goal of running games on Windows 95 is to expand the market to the gaming industry controlled by Nintendo and Sega. However, Microsoft does not want to use the OpenGL technology already available on NT. Microsoft has acquired
Rendermorphics, Ltd. obtained his 3D API called RealityLab. After reorganization, Microsoft has released a new 3D
API-Direct3D.

Microsoft, promote Direct3D, freeze OpenGL! Engage in the API battle. This is the history of DirectX!

DirectX, (Direct
EXtension, abbreviated as DX, is a multimedia programming interface created by Microsoft. By C++ Programming language implementation, following COM. Widely used in Microsoft
Windows, Microsoft XBOX, Microsoft XBOX 360, and Microsoft XBOX
ONE electronic game development, and can only support these platforms.

DirectX enhances 3D graphics and sound effects, and provides designers with a common hardware driver
Standards eliminate the need for game developers to write different drivers for each brand of hardware, and also reduce the complexity of user installation and hardware setup. Literally speaking, Direct means direct, while the following
The X represents many meanings, and from this point, it can be seen that the emergence of DirectX is to provide direct services for many software.

DirectX is not just a graphical API, it is a widely used API developed by Microsoft. According to its nature, it can be divided into four major parts: display, sound, input, and network. It has become an application platform, and currently, DirectX has a larger market share in game development.

The difference between OpenGL and DirectX

In terms of technology, OpenGL has strong portability, while DirectX can only be used for
The Windows operating system is an application program interface based on the Windows operating system platform. OpenGL is just a graphical function library, a professional 3D programming interface, designed as
Only output, therefore only rendering functionality is provided. The core API does not have the concept of window systems, audio, printing, and other input devices. It is precisely because of this design that the code it renders is completely independent of the running operations The system allows for cross platform development.

DirectX is a widely used API developed by Microsoft, which provides a complete set of multimedia interface solutions, particularly outstanding performance in 3D graphics.

In terms of hardware communication, DirectX allows programs to easily determine the hardware performance of a computer and then set program parameters that match it. This program enables multimedia software programs to run on Windows based computers with DirectX compatible hardware and drivers, while ensuring that multimedia programs can fully utilize high-performance hardware.

OpenGL is a hardware independent software interface that can run on any platform, and is inferior to DirectX's ability to set program parameters that match hardware. Currently, hardware developers are strengthening their support for it.

In terms of application, OpenGL remains an irreplaceable protagonist in the professional high-end drawing field OpenGL is widely used in industries including CAD, content creation, energy, entertainment, game development, and virtual reality. DirectX is suitable for multimedia, entertainment, and real-time 3D animation
In game development based on the Windows platform, it dominates the majority of the market for widespread and practical 3D graphics computing.

What is Unity Shader programming

Returning to the Unity engine, what is shader programming? We see individuals
The performance of graphics processors on computers is increasing day by day. And it makes the game execution speed run faster, but it does not prove that graphics processors have high-quality image representation. This is what PC graphics processors have been like so far The main limitations of development -
Fixed function. A fixed function means that chip designers need to incorporate hardware code from specific graphics algorithms into the graphics chip, and it also limits game and application developers to only work within these specific fixed algorithms Next.

The 3D application programming interfaces (OpenGL and DirectX) have been continuously evolving along the graphics hardware
Land development and progress. DirectX The most important feature in Graphics is the addition of programmable pipelines, which provide assembly language interfaces for hardware processing of deformation and lighting (vertex coloring) and pixel pipelines (pixel coloring). Programmable pipeline for development They provide great autonomy to implement real-time applications that have never been seen before.

To put it bluntly, a Shader shader is a program that runs on a GPU and can replace some of the fixed functions in the rendering pipeline. We use programmable pipeline rendering to achieve a richer display effect than using fixed pipeline rendering.