Introduction to graphical programming interfaces: OpenGL, OpenCL, Vulkan, OpenGL ES, WebGL, Metal, and Directx

Computer Graphics Program Interface | Graphics API

For ordinary computer players, this is not an important thing, but for game developers and those who play 3D games, this knowledge may be frequently mentioned, especially when it comes to game related topics. Computer graphics programming interfaces are a set of programmable open standards that require the underlying API support for both 3D and 2D. If you are a game developer who did not use graphical APIs to develop games, it means that when your game wants to call system hardware (GPU), this part of the program needs to be independently developed, which undoubtedly increases the cost of game development. The Graphics API is the solution to this problem. Developers can access hardware through the API by inputting a very small piece of code, which greatly improves both efficiency and quality. But it doesn't necessarily mean that the computer graphics program interface is very good. The Graphics API itself is software, not hardware. It just pre written the code to call the hardware for you, but there are also some issues:

In the operation of graphical interfaces and operating systems, well-known Microsoft and Apple systems have released their own unique Graphics APIs. To make their developed games run on different operating systems, different APIs may be required.

On the contrary, there is also a cross platform graphical programming interface, which means there is no need to adapt to the operating system separately, and development can be released to the entire platform at once. However, cross platform optimization cannot truly optimize performance across various operating systems, and ultimately is a compromise.

There is also a difference between high and low levels: the lower the cost of high-level development, the more difficult maintenance, and the smaller the permissions; The higher the underlying development cost, the lower the maintenance, and the greater the permissions.

OpenGL

OpenGL (Fully Written Open Graphics Library) defines a professional graphical programming interface that spans programming languages and platforms. It is used for 3D and 2D graphics and is a powerful and easily accessible underlying graphics library. OpenGL is the most widely accepted 2D/3D graphics API in the industry, and since its inception, it has spawned thousands of excellent applications on various computer platforms and devices. OpenGL is a hardware independent software interface that can be ported between different platforms such as Windows, Unix, Linux, MacOS, and OS/2. Therefore, software that supports OpenGL has good portability and can be widely applied. Due to OpenGL being the underlying graphics library for graphics, it does not provide geometric entity primitives and cannot be directly used to describe scenes.

At present, OpenGL has stopped development and will focus on promoting Vulkan interface after merging OpenCL. This is a graphical interface maintained by the same company, and it can be said that Vulkan will be the next generation cross platform graphical interface standard. Please refer to Vulkan for details.

Apple recently announced the abandonment of OpenGL/OpenCL and the promotion of its own Metal graphics interface, which means that many 3D software, games, etc. cannot run stably on macOS systems through OpenGL and other interfaces, and are more likely to directly fail to run. To run better, a separate adaptation to the Metal interface is required. For specific information, please refer to: Metal.

OpenGL

OpenCL (full name Open Computing Language) is the first open and free standard for parallel programming across platform systems. It is also a unified programming environment that facilitates software developers to write efficient and lightweight code for high-performance computing servers, desktop computing systems, and handheld devices. It is widely applicable to multi-core processors (CPUs), graphics processors (GPUs), and more The Cell type architecture and other parallel processors such as digital signal processors (DSPs) have broad development prospects in various fields such as gaming, entertainment, scientific research, and healthcare.

OpenCL was initially developed by Apple, which owned its trademark rights, and was initially improved through collaboration with AMD, IBM, Intel, and NVIDIA technology teams. Subsequently, Apple submitted this draft to Kronos Group, and the latest news is that Apple has abandoned OpenCL and stopped maintaining it.

VulKan

Vulkan is the next generation open graphics display API developed by the Khronos organization. It is a GPU API standard that can rival DirectX12. Vulkan is an evolution of the Mantle API based on AMD, providing a display driven abstraction layer that can directly control and access the underlying GPU. The display driver is just a thin packaging of hardware, which can significantly improve the efficiency and performance of operating GPU hardware. Previously, the driver layer of OpenGL had hidden many details from developers, but now it has been exposed. Vulkan does not even include the error checking layer during execution. The less work the driver layer does, the fewer hidden bugs it has.

Vulkan no longer uses OpenGL's state machine design and does not store global state variables internally. The display resources are entirely managed by the application layer. Including memory management, thread management, multi-threaded drawing command generation, rendering queue submission, etc. Applications can fully utilize the multi-core and multi-threaded computing resources of the CPU, reduce CPU waiting, and lower latency. The problem it brings is. The synchronization issue between threads is also the responsibility of the application, which places higher demands on developers.

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. This API is defined and promoted by the Khronos Group, a graphics software and hardware industry association that primarily focuses on open standards in graphics and multimedia.

OpenGL ES 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 automobiles. It consists of a carefully defined subset of desktop OpenGL, creating a flexible and powerful underlying interaction interface between software and graphics acceleration. OpenGL ES includes descriptions of floating-point and fixed-point operation systems, as well as EGL's local window system specifications for portable devices. OpenGL ES 1. X is designed for hardware with fixed functionality and provides acceleration support, graphics quality, and performance standards. OpenGL ES 2. X provides fully programmable 3D graphics algorithms, including occluder technology. OpenGL ES-SC is carefully crafted for special markets with high security requirements.

WebGL

WebGL (Full Write Web Graphics Library) is a 3D drawing protocol that allows for the integration of JavaScript and OpenGL ES 2.0. By adding a JavaScript binding to OpenGL ES 2.0, WebGL can provide hardware 3D accelerated rendering for HTML5 Canvas, allowing web developers to use the system graphics card to present 3D scenes and models more smoothly in the browser, as well as create complex navigation and data visualization. Obviously, the WebGL technology standard eliminates the hassle of developing specialized rendering plugins for web pages, and can be used to create website pages with complex 3D structures, and even to design 3D web games, and so on.

WebGL perfectly solves two problems of existing web interactive 3D animations: 1. It implements the production of web interactive 3D animations through HTML scripts themselves, without the need for any browser plugins. 2. It utilizes the underlying graphics hardware acceleration function for graphics rendering, which is implemented through a unified, standard, and cross platform OpenGL interface.

The WebGL standard has appeared in browsers such as Mozilla Firefox, Apple Safari, and developer preview versions of Google Chrome. This technology supports web developers to use system display chips to display various 3D models and scenes in browsers. It is expected to launch 3D web games and complex 3D structured website pages in the future.

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 the development of electronic games for Microsoft Windows, Microsoft XBOX, Microsoft XBOX 360, and Microsoft XBOX ONE, and can only support these platforms. The latest version is DirectX 12, created on the latest version of Windows 10.

Intended to make Windows based computers an ideal platform for running and displaying applications with rich multimedia elements such as full-color graphics, videos, 3D animations, and rich audio. DirectX includes security and performance updates, as well as many new features that cover all technologies. But this is not an ideal choice for cross platforms, it is only for Windows systems.

Metal

At WWDC 2014, Apple launched a new platform technology called Metal for game developers, which can improve 3D image rendering performance by 10 times and support familiar game engines and companies. Metal is a low-level rendering application programming interface that provides the lowest layer required by software, ensuring that the software can run on different graphics chips. Metal has improved the performance of Apple's A-series processors, allowing them to fully unleash their potential.

Metal is a new technology designed specifically for developers of highly immersive console games, allowing developers to fully leverage the performance of their chips. This technology has been optimized to enable processors and graphics processors to work together to achieve optimal performance. It is designed specifically for multithreading and provides various excellent tools to integrate all materials into Xcode. Although Apple has always emphasized that Metal is powerful, like DX, it is not a cross platform supported API, only for iOS and macOS, Apple's own operating system.