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 the scene with multiple views


One of the most common requirements for real time 3D applications is to render a scene to multiple view windows simultaneously. For example, a CAD/CAM-based application renders a scene to four types of views: perspective, orthographic front, side, and top view. In the scene graph architecture, multiple views are achieved with the help of rendering a scene to two or more cameras.

This recipe extends the last recipe to supporting multiple cameras, where each camera has different viewport region (which could be overlapped) and can have separate clear colors (depending on the requirement).

How to do it...

Here are the steps to implement this recipe:

  1. Now on, the screen clear color and buffer clearing will be applied within the Camera view itself. Remove the clear code from Renderer::render(). Define a vec4 type variable called clearColor to store the clear color information:

    void Camera::SetClearColor(glm::vec4 color){
        clearColor = color;
    }
  2. Apply the clear...