Cover
Title Page
Copyright and Credits
Contributors
Dedicated
Table of Contents
Preface
Part 1: Building a Graphics Renderer
Chapter 1: Creating the Game Window
Technical requirements
Getting the source code and the basic tools
Code organization in this book
The basic code for our application
NULL versus nullptr
Creating your first window
Adding support for OpenGL or Vulkan to the window
GLFW and OpenGL
GLFW and Vulkan
Event handling in GLFW
The GLFW event queue handling
Mixing the C++ classes and the C callbacks
The mouse and keyboard input for the game window
Key code, scan code, and modifiers
Different styles of mouse movement
Summary
Practical sessions
Additional resources
Chapter 2: Building an OpenGL 4 Renderer
Technical requirements
The rendering pipeline of OpenGL 4
Basic elements of the OpenGL 4 renderer
The OpenGL loader generator Glad
Anatomy of the OpenGL renderer
The main OpenGL class
Buffer types for the OpenGL renderer
Loading and compiling shaders
Vertex and fragment shaders
Creating our shader loader
Creating the simple Model class
Getting an image for the texture
Summary
Practical sessions
Additional resources
Chapter 3: Building a Vulkan Renderer
Technical requirements
Basic anatomy of a Vulkan application
Differences and similarities between OpenGL 4 and Vulkan
Technical similarities
Differences
Using helper libraries for Vulkan
Initializing Vulkan via vk-bootstrap
Memory management with VMA
Fitting the Vulkan nuts and bolts together
General considerations about classes
Changes in the Window class
Passing around the VkRenderData structure
Vulkan object initialization structs
Required changes to the shaders
Drawing the triangles on the screen
Differences and similarities between OpenGL and Vulkan, reprised
Summary
Practical sessions
Additional resources
Chapter 4: Working with Shaders
Technical requirements
Shader basics
GLM, the OpenGL Mathematics library
GLM data types and basic operations
GLM transformations
Vertex data transfer to the GPU
Switching shaders at runtime
Creating a new set of shaders
Binding the shader switching to a key
The shader switch in the draw call
Shader switching in Vulkan
Sending additional data to the GPU
Using uniform buffers to upload constant data
Creating a uniform buffer
Shader changes to use the data in the buffer
Preparing and uploading data
Using uniform buffers in Vulkan
Using push constants in Vulkan
Summary
Practical sessions
Additional resources
Chapter 5: Adding Dear ImGui to Show Valuable Information
Technical requirements
What is Dear ImGui?
Adding ImGui to the OpenGL and Vulkan renderers
Adding the headers to the OpenGL renderer
Adding the headers to the Vulkan renderer