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

Selecting locations on a texture map


This first demonstration will show how we select specific points on a texture map facing the camera, without rotation. We shall use the periodic table from chemistry to select specific atomic elements. While we have performed ray-bounding box intersections in previous examples, this is quite different in that we want to select a specific location within the texture map. Such an application is well suited to select an item from a textured wall, such as an image of a doorknob, a light switch, or in education, pointing to specific organs of a human being.

Prepare for lift off

Our first example is applied to chemistry but the actual demonstration is picking an exact point in a polygon. We are using the mouse to select one of the over one hundred elements from the periodic table. We need to click on that table to select a specific element. Because we need a specific point on the 3D mesh, we cannot simply use bounding boxes to determine if we clicked on an entire...