Computer Graphics with OpenGL - Part I
Jorge Martínez Garrido
June 16, 2024
Abstract
In this series, we will dive into the fundamentals of computer graphics using OpenGL. In this post, we explore the origin of the term. Then, the history of OpenGL is revisited together with some fundamental ideas. Next, other graphics APIs are presented. Finally, the software and hardware requirements for this tutorial are listed.
Computer graphics
The term computer graphics was originally coined in 1960 by William A. Fetter to describe his work at The Boeing Company.
One of the designs from William’s became very popular due to its aesthetics. This design was The Boeing Man. This wireman was the first model of a human body and it was used for modeling the figure of a pilot.
Other designs from William’s include experimental aircraft models. These complex shapes proof the usefulness of computer graphics, despite the limitations of the hardware in the 60s.
The development of OpenGL
During the 80s, the company Silicon Graphics Inc. (SGI), developed the Integrated Raster Imaging System Graphics Library (IRIS GL). This application programming interface (API) was propietary and could only run in SGI hardware.
A decade later, SGI recognized the need for standarization. A cross-platform graphics API specification was designed. OpenGL was born. The first version, OpenGL 1.0 was released in June 30, 1992.
To oversee the development and maintenance of OpenGL, a comitee was established in the same year. The OpenGL Architectural Review Board (ARB), known today as The Khronos Group, Inc., has an extensive membership list. Its members, mainly companies,are involved in various activities, including 3D graphics, virtual reality (VR), augmented reality (AR), parallel computing, among others.
But what exactly is OpenGL?
OpenGL is a graphics API specification. It is cross-platform, ensuring portability across systems. The latest OpenGL specification is OpenGL 4.6.
Specification. It describes the exact functionality, parameters, and return values for each function, as well as the expected results when these functions are called. This includes definitions for things like rendering primitives, texture mapping, shaders, and buffer objects.
API. An API is a set of functions and procedures that allow developers to perform tasks or interact with certain software or hardware. In the case of OpenGL, these functions are used for rendering 2D and 3D graphics. The API provides a standardized way for developers to access the functionality provided by the graphics hardware.
Implementation. The specification does not provide the actual code (implementation) of these functions. Instead, hardware and software vendors (such as GPU manufacturers) implement the API according to the specification. These implementations ensure that when developers use OpenGL functions, they get consistent behavior across different platforms and hardware. For an open-source implementation of OpenGL refer to The Mesa 3D Graphics Library.
Portability. By adhering to the OpenGL specification, developers can write graphics applications that are portable across different operating systems and hardware platforms. As long as the system has a compliant OpenGL implementation, the application should work correctly.
The next time you search how to download OpenGL or download latest OpenGL version, keep in mind that you are not looking for source code files. Instead, you should download the appropriate driver for your machine.
The evolution of OpenGL
OpenGL has evolved since its first release. Despite new major releases, OpenGL retains older features and capabilities. Despite being backwards compatible, they old specifications are discouraged in favor of modern ones.
It is important to mark the release of OpenGL 2.0 version. This version introduced the OpenGL Shading Language (GLSL). This shading language is used to program the so-called shaders. Shaders are programs that execute in the Graphic Processing Units (GPUs). Similarly to the cores of Central Processing Units (CPUs), GPUs cores are known as shaders.
Before shaders, OpenGL a rendering pipeline known today as fixed pipeline. This legacy pipeline is more intuitive on behalf of being less performant. Although GPUs are common nowadays, dedicated graphics hardware was not a common thing for the individual back in the days of OpenGL 1.0. Instead, CPU graphics or integrated graphics were used.
When a system lacks a GPU, the fallback mechanism of OpenGL is to use the CPU. Limitations may be faced in this scenario.
Other graphics APIs
OpenGL is not the only player in the game of graphic APIs. Some other alternatives to OpenGL include:
Vulkan. Developed by Khronos Group. Cross-platform. It is a low-overhead, cross-platform API designed to provide high-efficiency, cross-platform access to modern GPUs. It is known for its performance and ability to handle multiple CPUs and GPUs effectively.
DirectX. Developed by Microsoft. Platforms include Windows and Xbox. It includes Direct3D for 3D graphics, DirectInput for input, DirectSound for audio, and more. DirectX 12 offers low-level access to hardware for better performance.
Metal. Developed by Apple. Platforms include iOS and MacOS. It provides near-direct access to the GPU, enabling developers to create highly efficient and high-performance applications.
Other graphics APIs focus on platforms different than computers. For example:
OpenGL ES. Developed by Khronos Group. Cross-platform. It is a subset of the OpenGL specification targetting embedded systems (ES).
Web GPU. Developed by W3C. Cross-platform. Enables access to the GPU via Web applications. It is not related to [WebGL].
Hardware and software requirements
The dependencies for this series include:
- Hardware (integrated or dedicated) that supports OpenGL 3.3
- A C/C++ compiler or a Python 3 interpreter
- A text editor for writing the required code
Here are my specifications:
Intel i5-3320M with Intel HD Graphics 4000 integrated graphics. This is an Intel 3rd Gen Core mounted on a badass ThinkPad X230, a computer released in 2012.
C/C++ compiler is gcc. I will be using version 9.4.0, quite old too.
Yes, your honor, Neovim is my text editor.