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

Creating the circular pattern and making them revolve


This procedural texture recipe will make use of fragment coordinates to demonstrate a circular pattern using gl_FragCoord. The gl_FragCoord is a keyword available in the fragment shader that is responsible to store the window position of the current fragment in x and y coordinates; the z coordinate stores the depth of the fragment in the range [0, 1].

These coordinates are always relative to the OpenGL ES surface window; the gl_FragCoords is a result of a fixed functionality in which primitive are interpolated after the vertex processing stage to generate fragments. By default, the gl_FragCoord assumes the lower-left corner of the OpenGL ES rendering surface window as the origin. The following image shows the origin in the OpenGL ES surface window with different dimensions:

How to do it...

The light shading technique for this recipe will remain similar to the previous recipe; for more information, refer to the Phong shading – the per-fragment...