Introduction

GLFW (Graphics Library Framework) is a lightweight utility library for use with OpenGL. It provides programmers with the ability to create and manage windows and OpenGL contexts, as well as handle joystick, keyboard and mouse input.

It essentially is the link between the OS and the OpenGL API allowing the developper to create a Window and linking the window to an OpenGL context.

Features

Double buffering

In computer graphics, double buffering is used to prevent flickering when updating the content of a window or screen.

Here's how it works:

  1. Primary Buffer: There's a primary buffer, which represents the content currently displayed on the screen. This buffer is visible to the user.
  2. Back Buffer: In addition to the primary buffer, there's a back buffer that contains the new content you want to display.
  3. Rendering to Back Buffer: Instead of directly drawing to the primary buffer, you draw your graphics and images to the back buffer.
  4. Swap Buffers: Once the back buffer is fully rendered and ready to be displayed, you swap it with the primary buffer. This operation is typically done in a single atomic operation to avoid tearing artifacts.

By using double buffering, the screen is never updated partially while the new content is being drawn. Instead, the entire screen is updated at once when the back buffer is swapped with the primary buffer. This prevents flickering and creates a smoother visual experience for the user.