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

Procedural texture shading with texture coordinates


Texture coordinates control the wrapping of texture on the surface of a model; these are 2D coordinates used to map texture on the 3D surface of the geometry. Texture coordinates are mapped to a different coordinate system called UV Mapping. Letters U and V denote the axis of the texture along the x and y axis, respectively:

The preceding extreme left image shows an icon that needs to be mapped to a blue-colored square of some arbitrary dimension. An image (irrespective of its dimensions) is always treated in the UV mapping between a range of 0 to 1 along the U and V axis, respectively. Therefore, the bottom-left image is always (0, 0) and the top-left image is (1, 1); there is no need to assign these values in the OpenGL ES program. By default, it's understood by the graphics pipeline.

What needs to be mentioned is the texture coordinates of the 2D/3D model; for example; in the previous image, the blue color square is assigned with four...