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

Generating the polka dot pattern


This recipe is another procedural texture, which is an extension of our circle pattern shader. In that recipe, we looked at the logic behind producing a 2D circle pattern on a planar surface; this planar surface was created using fragment coordinates. In this recipe, we will create a polka dot pattern on the surface of the 3D mesh object; the main difference here is that instead of producing a logical circle in the square, we will use an inscribed logical sphere within the logical cube of dimensions Side x Side x Side units:

Getting ready

In this recipe, we have reused the lighting technique using the Implementing two-side shading recipe in Chapter 5, Light and Materials. The generic vertex attributes for vertex positions, normals, and texture coordinates are laid out with 0, 1, and 2 indexes, respectively.

How to do it...

Perform the following steps to implement the polka dot recipe:

  1. Create PolkaDotsVertex.glsl and reuse the code of the vertex shader from the...