Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Learn OpenGL

You're reading from   Learn OpenGL Beginner's guide to 3D rendering and game development with OpenGL and C++

Arrow left icon
Product type Paperback
Published in Aug 2018
Publisher Packt
ISBN-13 9781789340365
Length 208 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Frahaan Hussain Frahaan Hussain
Author Profile Icon Frahaan Hussain
Frahaan Hussain
Arrow right icon
View More author details
Toc

Adding an object and a light source

In this section, will discuss how to apply colors to your cube object. We'll also learn how to create shader files for light and for a source of light such as a lamp. And then we'll learn how to add the cube and the light source to our game world.

So, let's begin by creating new shader files for the light and the lamp.

Creating lighting and lamp shader files

Here we'll learn how to create shader files for a light source and a lamp and explore the code that will go into the vertex shaders and the fragment shaders. Perform the following steps to learn how create these shader files:

  1. First of all, for rename core.vs and core.frag from the previous chapters to lighting...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime