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

Font rendering with the FreeType project


In this recipe, we will render a simple Latin text in the 3D space. For this, we can create a texture bitmap for each character and render it in a quad geometry (rectangle) shape. However, creating each character bitmap could be expensive in terms of memory management and performance because it is required to load several bitmaps in the texture memory. Instead, the better solution is to create a big texture embedded with all characters in it and use their texture coordinates to map them on the geometry quad.

An overview of the process to render fonts using the FreeType library is as follows:

  1. Initialize the FreeType library. This initializes the necessary FreeType data structure.

  2. Load the font face. This loads the font file and generates the font style (font face) information.

  3. Specify the font size. With the specified size of the font, create an empty texture big enough to contain all glyphs. In order to make the texture backward compatible with OpenGL...