Book Image

Hands-On C++ Game Animation Programming

By : Gabor Szauer
Book Image

Hands-On C++ Game Animation Programming

By: Gabor Szauer

Overview of this book

Animation is one of the most important parts of any game. Modern animation systems work directly with track-driven animation and provide support for advanced techniques such as inverse kinematics (IK), blend trees, and dual quaternion skinning. This book will walk you through everything you need to get an optimized, production-ready animation system up and running, and contains all the code required to build the animation system. You’ll start by learning the basic principles, and then delve into the core topics of animation programming by building a curve-based skinned animation system. You’ll implement different skinning techniques and explore advanced animation topics such as IK, animation blending, dual quaternion skinning, and crowd rendering. The animation system you will build following this book can be easily integrated into your next game development project. The book is intended to be read from start to finish, although each chapter is self-contained and can be read independently as well. By the end of this book, you’ll have implemented a modern animation system and got to grips with optimization concepts and advanced animation techniques.
Table of Contents (17 chapters)

Getting glad

You can get glad from https://glad.dav1d.de/, a web-based generator:

  1. Go to the site, select Version 3.3 from the gl dropdown, and select Core from the Profile dropdown:
    Figure 1.4: Configuring glad

    Figure 1.4: Configuring glad

  2. Scroll to the bottom and hit the Generate button. This should start downloading a ZIP file that contains all of the required code.

The code presented in this book is forward compatible with OpenGL version 3.3 or a more recent version. If you want to use a newer OpenGL version, such as 4.6, change the gl dropdown under API to the desired version. You will be adding the contents of this ZIP file to your main project in the next section.

Adding glad to the project

Once glad.zip is downloaded, extract its contents. Add the following files from the ZIP file to your project. The directory structure does not need to be maintained; all of these files can be placed next to each other:

  • src/glad.c
  • include/glad/glad.h
  • include/KHR/khrplatform.h

These files will be included as normal project files—you don't have to set up include paths—but that does mean that the contents of the files need to be edited:

  1. Open glad.c and find the following #include:

    #include <glad/glad.h>

  2. Replace the include path with the relative path of glad.h:

    #include "glad.h"

  3. Similarly, open glad.h and find the following #include:

    #include <KHR/khrplatform.h>

  4. Replace the include path with the relative path of khrplatform.h:

    #include "khrplatform.h"

glad should now be added to the project and there should be no compilation errors. In the next section, you will start implementing the Win32 window.