Book Image

Learn OpenGL

By : Frahaan Hussain
Book Image

Learn OpenGL

By: Frahaan Hussain

Overview of this book

Learn OpenGL is your one-stop reference guide to get started with OpenGL and C++ for game development. From setting up the development environment to getting started with basics of drawing and shaders, along with concepts such as lighting, model loading, and cube mapping, this book will get you up to speed with the fundamentals. You begin by setting up your development environment to use OpenGL on Windows and macOS. With GLFW and GLEW set up using absolute and relative linking done, you are ready to setup SDL and SFML for both the operating systems. Now that your development environment is set up, you'll learn to draw using simple shaders as well as make the shader more adaptable and reusable. Then we move on to more advanced topics like texturing your objects with images and transforming your objects using translate, rotate and scale. With these concepts covered, we'll move on to topics like lighting to enable you to incorporate amazing dynamic lights in your game world. By the end of the book, you'll learn about model loading, right from setting up ASSIMP to learning about the model class and loading a model in your game environment. We will conclude by understanding cube mapping to bring advance worlds to your game.
Table of Contents (13 chapters)
Title Page
Copyright and Credits
Packt Upsell
Contributors
Preface
Index

Materials


We're going to discuss materials in this section. So, let's first understand what a material is and why would you use it. In the real world, you have objects that are made out of different materials. You have objects that are made out of metals, wood, plastic, and other stuff. As a result, these materials, these objects, react differently to light depending on what they're made out of. Generally speaking, something that's made out of metal will be shinier than something that's made out of wood. Wood generally isn't shiny. Obviously, it is if you apply some sort of varnish to it, but again, that would be an additional layer to the object that's not wood. It'd be something more than wood that is applied on top of it that provides some sort of shine to it. You have glossy materials, and you have some more matte materials. Simply put, materials in OpenGL will allow us to create objects that react differently to light, and as a result, create more realistic and varied effects in our...