Book Image

Beginning C++ Game Programming

Book Image

Beginning C++ Game Programming

Overview of this book

This book is all about offering you a fun introduction to the world of game programming, C++, and the OpenGL-powered SFML using three fun, fully-playable games. These games are an addictive frantic two-button tapper, a multi-level zombie survival shooter, and a split-screen multiplayer puzzle-platformer. We will start with the very basics of programming, such as variables, loops, and conditions and you will become more skillful with each game as you move through the key C++ topics, such as OOP (Object-Orientated Programming), C++ pointers, and an introduction to the Standard Template Library. While building these games, you will also learn exciting game programming concepts like particle effects, directional sound (spatialization), OpenGL programmable Shaders, spawning thousands of objects, and more.
Table of Contents (24 chapters)
Beginning C++ Game Programming
Credits
About the Author
About the Reviewer
www.PacktPub.com
Dedication
Preface
17
Before you go...

OpenGL, shaders, and GLSL


Open Graphics Library (OpenGL) is a programming library that handles 2D and 3D graphics. OpenGL works on all major desktop operating systems and there is also a version, OpenGL ES, that works on mobile devices.

OpenGL was originally released in 1992. It has been refined and improved over more than twenty years. Furthermore, graphics cards manufacturers design their hardware to make it work well with OpenGL. The point of telling you this is not for the history lesson, but to explain that it would be a fool's errand to try and improve upon OpenGL, and using it in 2D (and 3D) games on the desktop, especially if you want your game to run on more than just Windows, is the obvious choice. We are already using OpenGL because SFML uses OpenGL. Shaders are programs that run on the GPU itself, so let's find out more about them next.

The programmable pipeline and shaders

Through OpenGL we have access to what is called a programmable pipeline. We can send our graphics off to...