Book Image

OpenGL ES 3.0 Cookbook

By : Parminder Singh
Book Image

OpenGL ES 3.0 Cookbook

By: Parminder Singh

Overview of this book

<p>"Write once, use anywhere" is truly the power behind OpenGL ES and has made it an embedded industry standard. The library provides cutting-edge, easy-to-use features to build a wide range of applications in the gaming, simulation, augmented-reality, image-processing, and geospatial domains.</p> <p>The book starts by providing you with all the necessary OpenGL ES 3.0 setup guidelines on iOS and Android platforms. You'll go on to master the fundamentals of modern 3D graphics, such as drawing APIs, transformations, buffer objects, the model-view-project analogy, and much more. The book goes on to deal with advanced topics and offers a wide range of recipes on the light shading, real-time rendering techniques with static and procedure textures to create stunning visualizations and runtime effects.</p>
Table of Contents (21 chapters)
OpenGL ES 3.0 Cookbook
Credits
About the Author
Acknowledgments
About the Reviewers
www.PacktPub.com
Preface
Index

Gouraud shading – the per-vertex shading technique


This recipe implements the Phong reflection model with all the three components of light, that is, ambient (A), diffuse (D), and specular (S), which we looked at in the previous recipes. This illumination technique is also known as ADS or Gouraud shading. The Gouraud shading technique is per-vertex shading because the fragment's color is calculated in the vertex shader by using each vertex's position information.

Getting ready

This recipe combines the effect of our ambient (A), diffuse (D), and specular (S) illumination, which we have implemented in our previous recipes, using the Phong reflection model technique. Mathematically, it's the summation of ambient, diffuse, and specular fragment colors:

Gouraud shading color = ambient color + diffuse color + specular color

Before implementing the Gouraud shading, it's advisable to understand ambient, diffuse, and specular illumination techniques thoroughly, as mentioned in this chapter.

How to do...