Understanding 2D graphics operations behind the scenes
In this section, before we start writing a line of code to work with a 2D graphic image, let’s first find out how the modern generation of GPU hardware and display drivers handle graphics images behind the scenes.
Loading and rendering a texture as an image
The GPU hardware renders and processes graphic image data in real time. Real-time rendering is now predominantly managed by the modern generation of GPUs. As a result, understanding key concepts related to graphics hardware is crucial for developing games with smooth visuals and good runtime performance.
Figure 4.1 shows the process of how a static image is rendered on the screen from a graphic file stored on a storage device.

Figure 4.1 – The process behind displaying an image on the screen
In Figure 4.1, the image is first loaded from secondary storage (e.g., a hard drive or the cloud) into system memory by the CPU, then uploaded into...