Table Of Contentffffiirrss..iinndddd ii 1122//3300//1111 1122::0055::2233 PPMM
GAME AND GRAPHICS PROGRAMMING FOR IOS
® ®
AND ANDROID WITH OPENGL ES 2.0
INTRODUCTION . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .xvii
CHAPTER 1 Getting Started . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1
CHAPTER 2 Setting Up Your Graphic Projections . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
CHAPTER 3 Dealing with Complex Geometry . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .29
CHAPTER 4 Building a Scene . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
CHAPTER 5 Optimization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .81
CHAPTER 6 Real-Time Physics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97
CHAPTER 7 Camera . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129
CHAPTER 8 Pathfi nding . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .151
CHAPTER 9 Audio and Other Cool Game Programming Stuff . . . . . . . . . . . . . . . . . . .171
CHAPTER 10 Advanced Lighting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .207
CHAPTER 11 Advanced FX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .237
CHAPTER 12 Skeletal Animation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .259
INDEX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 273
ffffiirrss..iinndddd ii 11//1111//1122 88::2200::5588 AAMM
ffffiirrss..iinndddd iiii 11//1111//1122 88::2200::5599 AAMM
Game and Graphics Programming
for iOS and Android®
with OpenGL® ES 2.0
ffffiirrss..iinndddd iiiiii 11//1111//1122 88::2211::0000 AAMM
ffffiirrss..iinndddd iivv 11//1111//1122 88::2211::0000 AAMM
Game and Graphics Programming
for iOS and Android®
with OpenGL® ES 2.0
Romain Marucchi-Foino
John Wiley & Sons, Inc.
ffffiirrss..iinndddd vv 11//1111//1122 88::2211::0000 AAMM
Game and Graphics Programming for iOS and Android® with OpenGL® ES 2.0
This edition fi rst published 2012
Copyright ©2012 Romain Marucchi-Foino
Registered offi ce
John Wiley & Sons Ltd, The Atrium, Southern Gate, Chichester, West Sussex, PO19 8SQ, United Kingdom
For details of our global editorial offi ces, for customer services and for information about how to apply for permission to
reuse the copyright material in this book please see our web site at www.wiley.com.
The right of the author to be identifi ed 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.
978-1-119-97591-5
978-1-119-97626-4 (ebk)
978-1-119-97627-1 (ebk)
978-1-119-97628-8 (ebk)
A catalogue record for this book is available from the British Library.
ffffiirrss..iinndddd vvii 11//1111//1122 88::2211::0022 AAMM
ABOUT THE AUTHOR
ROMAIN MARUCCHI-FOINO is the original author and founder of the popular mobile game engine
SIO2 (http://sio2interactive.com). Formerly a game engine developer, Romain has dedicated
his efforts to build a state-of-the-art game engine for mobile devices using OpenGL ES since the
arrival of the iPhone. He is currently working as the lead 3D programmer for sio2interactive
.com, the offi cial developer of the SIO2 Engine, which powers thousands of games and 3D
applications throughout the App Store and the Android market. His experience in the mobile game
industry has led him to contribute his work to many online c ommunities, publications, and blogs.
ABOUT THE TECHNICAL EDITOR
EFFIE C. LEE is a self-employed game and graphics designer who has been working in the game
industry for the last 4 years. With a bachelor’s degree in Computer Science and a real passion
for electronic games and computer graphics, she has been involved in multiple mobile game
productions. With her wide range of knowledge in the game development process, she has been
professionally working as a 2D and 3D graphics designer, game programmer (scripting), and web
designer for game sites, as well as managing game quality assurance and localization. If you would
like to reach her, send an email to effiecl@gmail.com.
ffffiirrss..iinndddd vviiii 11//1111//1122 88::2211::0022 AAMM
ffffiirrss..iinndddd vviiiiii 11//1111//1122 88::2211::0022 AAMM
Description:Develop graphically sophisticated apps and games today!The smart phone app market is progressively growing, and there is new market gap to fill that requires more graphically sophisticated applications and games. Game and Graphics Programming for iOS and Android with OpenGL ES 2.0 quickly gets you u