OpenGL ES 2 for Android: A Quick-Start Guide (Pragmatic Programmers) 1st Edition
| Kevin Brothaler (Author) Find all the books, read about the author, and more. See search results for this author |
Use the Amazon App to scan ISBNs and compare prices.
Printed in full color.
Android is booming like never before, with millions of devices shipping every day. It's never been a better time to learn how to create your own 3D games and live wallpaper for Android. You'll find out all about shaders and the OpenGL pipeline, and discover the power of OpenGL ES 2.0, which is much more feature-rich than its predecessor. If you can program in Java and you have a creative vision that you'd like to share with the world, then this is the book for you.
This book will teach you everything you need to know to create compelling graphics on Android. You'll learn the basics of OpenGL by building a simple game of air hockey, and along the way, you'll see how to initialize OpenGL and program the graphics pipeline using shaders. Each lesson builds upon the one before it, as you add colors, shading, 3D projections, touch interaction, and more.
Then, you'll find out how to turn your idea into a live wallpaper that can run on the home screen. You'll learn about more advanced effects involving particles, lighting models, and the depth buffer. You'll understand what to look for when debugging your program, and what to watch out for when deploying to the market.
OpenGL can be somewhat of a dark art to the uninitiated. As you read this book, you'll learn each new concept from first principles. You won't just learn about a feature; you'll also understand how it works, and why it works the way it does. Everything you learn is forward-compatible with the just-released OpenGL ES 3, and you can even apply these techniques to other platforms, such as iOS or HTML5 WebGL.
Customers who bought this item also bought
Editorial Reviews
Amazon.com Review
Top Five OpenGL ES Tips
1. Avoid expensive operations on the UI and rendering threads.
To avoid frame rate stutters or the dreaded "Application not responding" dialog from appearing, expensive operations should be run asynchronously in a background thread. This is especially important when it comes to the rendering thread, as rendering at 30 frames per second means that each frame has to complete in about 33 milliseconds to avoid frame stutters.
Garbage collection is an expensive operation that happens non-deterministically and can cause rendering stalls, so to avoid this, you'll also want to minimize object allocation during a frame to reduce pressure on the garbage collector. You may even see benefits to doing a manual GC at certain points in the application.
2. Do expensive texture and shader loads during intermissions.
Some expensive operations need to be done on the rendering thread, such as texture loads and shader compilations. These operations can cause noticeable stuttering if they happen in the middle of rendering, so to avoid this, preload these resources at opportune times, such as when the game / application is loaded, or at the beginning of each level.
3. Take advantage of the libraries out there.
There are many libraries out there that support OpenGL ES 2.0 development without boxing you into a framework or a closed-source middleware solution. Libgdx is one of these libraries, and by using a library like libgdx, you can more easily port your code to other platforms, as well as take advantage of the library's math classes and asset loading management.
4. Read the documentation.
The OpenGL specs and manuals are available for free from Khronos.org. Each GPU vendor also shares a wealth of free information on how to use their GPUs, and as you read the documentation, you'll find that they generally share a lot of advice in common, such as "minimize state switches" and "avoid discard in a fragment shader." Reading these documents and specs will give you a lot more insight into how the GPUs work at a lower level, and will help you understand what the pitfalls are, and how to avoid premature pessimization when writing your OpenGL code.
5. Focus on what will impress the end user.
Sometimes it's easy to lose sight of the end goal, and to become focused on optimizing areas that won't make much of a difference to the end user. Does it matter if we get this shader to execute 2% faster? Or will we make much more of a visual impact by finding a better artist? Find out what the most important areas are, and then focus on improving those first.
About the Author
Kevin Brothaler is the founder of Digipom, a mobile software development shop. He has extensive experience in Android development, and he also manages "Learn OpenGL ES":http://www.learnopengles.com/, an online set of OpenGL tutorials for Android and WebGL.
Don't have a Kindle? Get your Kindle here, or download a FREE Kindle Reading App.
Product details
- Publisher : Pragmatic Bookshelf; 1st edition (July 16, 2013)
- Language : English
- Paperback : 346 pages
- ISBN-10 : 1937785343
- ISBN-13 : 978-1937785345
- Item Weight : 1.47 pounds
- Dimensions : 7.5 x 0.72 x 9.25 inches
- Best Sellers Rank: #1,615,707 in Books (See Top 100 in Books)
- #58 in OpenGL Software Programming
- #209 in 3D Graphic Design
- #654 in Digital Video Production (Books)
- Customer Reviews:
About the author

Discover more of the author’s books, see similar authors, read author blogs and more
Customer reviews
Top reviews from the United States
There was a problem filtering reviews right now. Please try again later.
It's an easy read, about 2 days of reading, more if you type in every single example.
This book is also great if you already know shaders, but you are unfamiliar with using them with the Android SDK. Android can be a bit tricky at times and this book will navigate you through the Android SDK so that your shaders work as intended.
There are chapters in the book that go over Textures, creating a SkyBox, using Vertex Buffer Objects, using Index Buffer Objects, Culling, developing Particle Shaders, Vertex Shader Fundamentals, Fragment Shader fundamentals, creating Terrain, enabling the Depth Buffer, simulating Lights, and MORE! Overall, great book!
What this book isn't : This book is not a discussion of the design choices, architecture or theory behind OpenGL or Android.
If you want a book that helps you get right to work, this book is hard to beat. If you want something to give you a better architectural understanding of OpenGL you would be better looking elsewhere.
Top reviews from other countries
The reader is naturally expected to be familiar with Java and the Android platform but the sample code is clear, fully explained and is presented gradually so that it's easy to understand what's going on. There is code on almost every page as the reader is shown how to build various OpenGL ES programs, with each chapter building on the previous one to improve and expand the application, be it the 3D air hockey game or live wallpaper.
For someone who is looking to take their very first steps with OpenGL ES on Android, this book is a great choice and will quickly get you started.
I think the examples are a little simplistic, but I feel this is intentional as the book is about OpenGL specifically, not using OpenGL to write games. All the sample code is available on the publisher's website so once you're done with the book this acts as a good point of reference point for when you venture off to write your own code. Some simple lighting techniques are also outlined which provide a good basis for further learning.
Over all I found this book very useful. I was originally hoping it would be more geared towards game development, but now I believe it works better as the two subjects (3D graphics and games development) are difficult subjects for their own reasons and interleaving the explanation of the two subjects would probably be off-putting for newcomers (such as myself)
If you don't believe me, check out the free stand-alone tutorials at http://www.learnopengles.com/android-lesson-one-getting-started/
The Book goes into more detail.



