Book Image

WebGL HOTSHOT

By : Mitch Williams
Book Image

WebGL HOTSHOT

By: Mitch Williams

Overview of this book

Table of Contents (17 chapters)
WebGL HOTSHOT
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Rendering a scene as a texture to view multiple cameras simultaneously


One of the more fascinating aspects of working in 3D computer graphics is not that we can recreate a photorealistic world, but that we can create worlds that cannot exist in the real world. We are unbound by physics, and can create one-way walls or walk through portals to get from one location to another in an instant. Clearly, it is not traditional architecture as we know it, nor should it be.

Until now, every 3D mesh we have sent to the drawScene() function has been drawn onto a canvas embedded inside a web page. But now, we are going to render the scene as a texture map, then apply that texture map onto a 3D mesh in our scene. Think of this as if we had a room with security cameras, and we wanted to show the scene from the security camera on a 3D mesh that was a television monitor.

Prepare for lift off

In rendering the scene to be later used as a texture map, we are essentially taking over part of the rendering process...