Skip to Main Content
WebGL Beginner's Guide
book

WebGL Beginner's Guide

by Diego Cantor, Brandon Jones
June 2012
Beginner content levelBeginner
376 pages
8h 32m
English
Packt Publishing
Content preview from WebGL Beginner's Guide

Time for action – customizing the application

  1. Open the file ch9_Car_Showroom.html using your favorite code editor.
  2. We will assign a different home for the camera when we load the Ford Mustang. To do so, please check the cameraHome, cameraAzimuth, and cameraElevation global variables. We set up the camera home position by using this variable inside the configure function like this:
    camera.goHome(cameraHome);
    camera.setAzimuth(cameraAzimuth);
    camera.setElevation(cameraElevation);

    Let's use this code to configure the default pose for the camera when we load the Ford Mustang. Go to the loadMustang function and append these lines:

    cameraHome = [0,0,10]; cameraAzimuth = -25; cameraElevation = -15; camera.goHome(cameraHome); camera.setAzimuth(cameraAzimuth); ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Programming 3D Applications with HTML5 and WebGL

Programming 3D Applications with HTML5 and WebGL

Tony Parisi

Publisher Resources

ISBN: 9781849691727Other