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

Culling in OpenGL ES 3.0


Culling is an important technique in 3D graphics. It is used to discard the faces that are not visible to the user. In an enclosed geometry, the faces pointing towards the camera hide the faces behind it, either partially or completely. These faces can be easily avoided during rendering by the culling technique. This is an easier way to speed up the performance in OpenGL ES graphics. There are two types of faces:

  • Front face: The face in an enclosed 3D object that points outward are considered to be the front face

  • Back face: The face in an enclosed 3D object that points inside of these faces are considered as to be the back face

How to do it...

Culling can be enabled in OpenGL ES 3.0 using the glenable API with GL_CULL_FACE as state flag. By default, OpenGL ES 3.0 culls the back face. This can be changed using the glCullFace API. Tap on the screen to switch between the front and back culling modes. This recipe will display the outside faces of the cube when back face...