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 2D textured button widgets


OpenGL ES does not provide built-in UI components, such as buttons, radio box, checkbox, and so on. In general, these components are called 2D widgets and are laid out in the HUD in the screen coordinate system, where the z component is either zero or not at all used. This recipe will guide us to design and lay out 2D widgets on the screen coordinate system using OpenGL ES.

This recipe contains two recipes:

  • The first recipe allows you to create the geometry of a simple button. Geometrical coordinates are specified in the local screen coordinate system, which is useful in designing the layout.

  • The second recipe is implemented in the There's more... section of this recipe, where we used the ray-picking technique, making the button clickable. Selecting the button will change its color.

The next image shows the output of the first recipe. It contains six buttons of 32 x 32 dimensions. Each button is scaled by a factor of two, resulting in the final dimension...