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 fisheye with barrel distortion


Fisheye is an effect in which a scene looks sphered. As a result, edges in the scene look curved and bowed around the center of this virtual sphere. This effect makes the scene look like wrapped around a curved surface.

The barrel distortion technique is used to achieve the present effect, which can be applied to fragments or vertices. This recipe will implement the barrel distortion on the fragment shader first and then apply it to the vertex shader. The difference between the two is this; in the former shader, the geometry does not distort. However, texture coordinates are distorted, resulting in a magnifying lens effect or a fisheye lens effect. In the latter technique, the geometry is displaced and creates different amusing distorted shapes. Note that this is not a post processing technique.

Getting ready

For this recipe, we can reuse our first recipe and replace the edge detection logic with the current barrel distortion fragment shader: BarrelDistFishEyeFragment...