Want to create sophisticated games and graphics-intensive apps? Learn OpenGL ES gets you started immediately with OpenGL ES. After mastering the basics of OpenGL ES itself, you will quickly find yourself writing and building game apps, without having to learn about object oriented programming techniques.
This book demonstrates the use of a powerful open-source modeling tool, Blender. You will be guided, step by step, through the development of Tank Fence, a dynamic, interactive 3D game. Along the way you'll gain skills in building apps with Eclipse and the Android SDK or NDK, rendering graphics using hardware acceleration, and multithreading for performance and responsiveness. iOS developers will also find this book's information invaluable when writing their apps.
You'll learn everything you need to know about:
Creating simple, efficient game UIs Designing the basic building blocks of an exciting, interactive 3D game Pulling all the elements together with Blender, a powerful open-source tool for modeling, animation, rendering, compositing, video editing, and game creation Taking the next big step using custom and inbuilt functions, texturing, shading, light sources, and more Refining your mobile game app through collision detection, player-room-obstacle classes, and storage classes Doing all this efficiently on mobile devices with limited resources and processing
Author(s): Prateek Mehta
Publisher: Apress
Year: 2013
Language: English
Pages: 220
Contents at a Glance
Contents
About the Author
About the
Technical Reviewer
Acknowledgments
Preface
Chapter 1: Benefits of the New API
Modern Graphic-rendering API
Devices Love It
Easy App Development: Let’s Create an OpenGL Surface View
Determining OpenGL ES Version
Creating the OpenGL Surface
ES 2.0 Is for the Ambitious
Where Are the Developers?
Summary
Chapter 2: Implementation Prerequisites
Selecting a Development Device: Why Upgrade to Gingerbread?
Choosing Inputs That Your Game Needs
Tank Fence
Creating Menus for the Game
Setting Views Using setContentView and addContentView
Sleek Design of XML Views
Working with Buttons and the Counter Class
Using Touch for Rotation
Rotation Using Android Sensors
Summary
Chapter 3: ES 2.0 Fundamentals
EGL on Android
The GLSurfaceView Class
Setting up the Renderer
Renderer Thread
Decoupling for Dedicated Performance
Thread Safety
Implemented Methods
Anatomy of a Renderer
GL SURFACE CHANGED Application
Framebuffer
Double Buffering
Clearing the Color Buffer
Setting the Viewport
GLSL
Shader Program
Vertex Shader Example
Data Types
Fragment Shader Example
GL POINT BASIC Application
Using the loadShader Method
Attributes
Drawing Line and Triangle Primitives
Varyings
Triangle Primitive
Normalized Device Coordinate System
3D-Transformation
Types of Transformations
The Matrix Class
State Management
Cull Face
Depth Test
Summary
Chapter 4: 3D Modeling
Drawing Shapes Using glDrawElements
GL POINT ELEMENTS Application
Drawing Line and Triangle Primitives
Blender for Modeling
Default Layout
Using Object Mode
Panels in 3D View
Translating Objects
Using the Lasso-Select Command
Modeling Objects for the Game
Creating an Equilateral Triangle
tankFence Blender File
Material Context
Player Object
Adding Plane Mesh
Editing the Player Object
Exporting Mesh Data
Parsing Objects for OpenGL ES
Installing Perl
Downloading Parser
Using the Parser
Using the Mesh Data
Adding the Player Object
Basic Components in the Blender Interface: Screenshots
Summary
Chapter 5: Texturing and Shading
Vertex Buffer Objects
Types of Buffer Objects
Using Buffer Objects
Using Color Masks
Textures
2D Texture
Loading the Image Data
sampler2D Uniform Variable
Using Texture and Color
Cubemap Textures
Loading Images for a Cubemap Texture
samplerCube Uniform Variable
Multi-Texturing
Lighting Effects Using Shader Programs
Illumination Models
Diffuse Reflection: Equations for Illumination
Lighting Equation in Vertex Shader
Interpolating Vertex Normal
Summary
Chapter 6: Taking the Development Ahead
Specifying the Render Mode
Adding the Fire Button
Combining Translation with Rotation
Including Missiles for the Tank
The initMissiles Method
Updating the Missiles ArrayList
The Enemy Class
Spawning Enemies
Interpolating Enemy Source Position
Detecting Collisions to Annihilate the Enemy
Summary
Index