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

Implementing the binocular view with procedural texturing


This recipe implements a binocular view effect, where a scene is rendered as if it's visualized from the binocular itself. We will implement this effect by programing a procedural shader. Alternatively, in another technique, the alpha-mapped texture is used instead. In this approach, an alpha-masked texture containing a binocular view image is superimposed on top of the scene. This way, only those parts of the scene are visible that belong to the nonmasked texture region.

The procedural textured approach is also relatively simpler. Here, the scene is programmed in the fragment shader where the binocular view effect is created using texture coordinates of the vertices. Texture coordinates are used to create a logical circular region on the rendered image. The fragment that belongs outside the circumference of this circular region are rendered with an opaque color (say black). This opacity reduces as the distance shrinks toward the center...