Contents
This edition first published 2012
2012 Andreas Anyuru
Registered office
John Wiley & Sons Ltd, The Atrium, Southern Gate, Chichester, West Sussex, PO19 8SQ, United Kingdom
For details of our global editorial offices, for customer services and for information about how to apply for permission to reuse the copyright material in this book please see our website at www.wiley.com .
The right of the author to be identified as the author of this work has been asserted in accordance with the Copyright, Designs and Patents Act 1988.
All rights reserved. No part of this publication may be reproduced, stored in a retrieval system, or transmitted, in any form or by any means, electronic, mechanical, photocopying, recording or otherwise, except as permitted by the UK Copyright, Designs and Patents Act 1988, without the prior permission of the publisher.
Wiley also publishes its books in a variety of electronic formats. Some content that appears in print may not be available in electronic books.
Designations used by companies to distinguish their products are often claimed as trademarks. All brand names and product names used in this book are trade names, service marks, trademarks or registered trademarks of their respective owners. The publisher is not associated with any product or vendor mentioned in this book. This publication is designed to provide accurate and authoritative information in regard to the subject matter covered. It is sold on the understanding that the publisher is not engaged in rendering professional services. If professional advice or other expert assistance is required, the services of a competent professional should be sought.
Limit of Liability/Disclaimer of Warranty: The publisher and the author make no representations or warranties with respect to the accuracy or completeness of the contents of this work and specifically disclaim all warranties, including without limitation warranties of fitness for a particular purpose. No warranty may be created or extended by sales or promotional materials. The advice and strategies contained herein may not be suitable for every situation. This work is sold with the understanding that the publisher is not engaged in rendering legal, accounting, or other professional services. If professional assistance is required, the services of a competent professional person should be sought. Neither the publisher nor the author shall be liable for damages arising herefrom. The fact that an organization or Web site is referred to in this work as a citation and/or a potential source of further information does not mean that the author or the publisher endorses the information the organization or Web site may provide or recommendations it may make. Further, readers should be aware that Internet Web sites listed in this work may have changed or disappeared between when this work was written and when it is read.
Trademarks: Wiley, the Wiley logo, Wrox, the Wrox logo, Wrox Programmer to Programmer, and related trade dress are trademarks or registered trademarks of John Wiley & Sons, Inc. and/or its affiliates, in the United States and other countries, and may not be used without written permission. Google Chrome is a trademark of Google Inc. Use of this trademark is subject to Google Permissions. All other trademarks are the property of their respective owners. John Wiley & Sons, Ltd., is not associated with any product or vendor mentioned in this book. The WebGL specification copyright is owned by the Khronos Group Inc. The OpenGL ES Man Pages copyright is owned by the Khronos Group Inc. and Silicon Graphics Inc. Khronos and WebGL are trademarks of the Khronos Group Inc. OpenGL is a registered trademark and the OpenGL ES logo is a trademark of Silicon Graphics International used under license by Khronos.
978-1-119-96886-3
978-1-119-94058-6 (ebk)
978-1-119-94059-3 (ebk)
978-1-119-94060-9 (ebk)
10 9 8 7 6 5 4 3 2 1
A catalogue record for this book is available from the British Library.
To Jessica, Tilde, and Victor
ABOUT THE AUTHOR
ANDREAS ANYURU has extensive experience with various web technologies, including WebGL. He has worked with web browser integration and optimizations for mobile devices for many years. Andreas is one of the contributors to the V8 JavaScript engine that is used in Google Chrome for desktops and in Android. He has developed new courses and taught at the Information and Communications Engineering division at Lund University.
Andreas is a Senior Member of Technical Staff at ST-Ericsson, where his primary area of expertise is web technologies. In this position, he is responsible for ensuring that existing and forthcoming web technologies work in an optimal way on ST-Ericssons Linux-based mobile platforms.
Andreas holds a M.Sc. in Electrical Engineering from Lund University, Faculty of Engineering, Sweden.
ABOUT THE TECHNICAL EDITOR
PAUL BRUNT was working with JavaScript early on in the emergence of HTML5 to create some early games and applications that made extensive use of SVG, canvas, and a new generation of fast JavaScript engines. This work included a proof-of-concept platform game demonstration called Berts Breakdown. With a keen interest in computer art and an extensive knowledge of Blender, combined with knowledge of real-time graphics, the introduction of WebGL was the catalyst for the creation of GLGE. He began work on GLGE in 2009 when WebGL was still in its infancy, gearing it heavily towards the development of online games. Paul has also contributed to other WebGL frameworks and projects, as well as porting the jiglib physics library to javascript in 2010, demoing 3D physics within a browser for the first time.
CREDITS
VP CONSUMER AND TECHNOLOGY PUBLISHING DIRECTOR
Michelle Leete
ASSOCIATE DIRECTORBOOK CONTENT MANAGEMENT
Martin Tribe
ASSOCIATE PUBLISHER
Chris Webb
EXECUTIVE COMMISSIONING EDITOR
Birgit Gruber
ASSISTANT EDITOR
Ellie Scott
ASSOCIATE MARKETING DIRECTOR
Louise Breinholt
SENIOR MARKETING EXECUTIVE
Kate Parrett
EDITORIAL MANAGER
Jodi Jensen
SENIOR PROJECT EDITOR
Sara Shlaer
DEVELOPMENT EDITOR
Box Twelve Communications, Inc.
TECHNICAL EDITOR
Paul Brunt
COPY EDITOR
Marylouise Wiack
SENIOR PRODUCTION EDITOR
Debra Banninger
PROOFREADER
Nancy Carrasco
INDEXER
Robert Swanson
COVER DESIGNER
LeAndra Young
COVER IMAGE
iStock / Mark Evans
ACKNOWLEDGMENTS
A BIG THANK YOU goes to the Khronos WebGL Working Group, which created the WebGL specification and the browser vendors, including open source projects, which have implemented the specification. Without your work, this book would not exist. In addition, I want to thank all developers in the WebGL community who have contributed to WebGL as a technology with their discussions, experiments, and examples.
I want to thank the people at Wiley, especially Jeff Riley, Sara Shlaer, Ellie Scott, and Chris Webb. You have all done a great job supporting me.
I want to say thank you to all my great colleagues at ST-Ericsson you make ST-Ericsson a great place to work. I especially want to thank Kent Olsson, Christian Bejram, Marco Cornero, Gran Roth, and Patrik berg for believing in me, supporting me, and coaching me.
I want to thank my family for their support and understanding while writing this book. Most of all, I want to say thanks to my wonderful wife Jessica, whom I love very much. Thanks for everything, Jessica!