Game Development Reference
In-Depth Information
The Power of Mobile Devices
Mobile Android devices have become pretty powerful for graphics development. Check out
the following hardware stats for the Samsung Galaxy S:
Processor : 1 GHz ARM Cortex-A8 based CPU core
GPU : 200 MHz PowerVR SGX 540
Memory : 394 MB RAM
Display : 4.0 in (100 mm) Super AMOLED with RBGB-Matrix (Pentile)
800×480 pixels WVGA (233 ppi)
To make good use of the GPU, Google has included the OpenGL Embedded System (ES)
within Android. OpenGL ES provides the software API to make high-performance, hardware-
accelerated games possible. This is a Java API, which is good news for Java developers
who want to create 3D games from scratch, but bad news for C developers who want to
reuse 3D engines written in C. 3D game engines are very complex and large, and are mostly
written in C. Rewriting these engines in Java would be a difficult task, consuming significant
development and time resources.
Please refer to this link to read about the OpenGL ES specifications and documentation:
https://www.khronos.org/registry/gles/ .
A HEAD START: THE SOURCE CODE FOR THIS CHAPTER
In this chapter, you'll use the Android 3D cubes sample in its original Java language. This sample is available
from the Android site; however, the sample is composed of many resources, which are bundled as part of
the overall Android samples pack. To make things simpler, I have packed the required files, plus the changes
described throughout this chapter, in the chapter source code.
If you wish, you can import the project into your workspace. To do so, select File ➤ Import. In the dialog box,
select Existing Projects into Workspace. Next, navigate to the chapter source ch03.OpenGL . Optionally, check
Copy project into workspace. When you click Finish, the automated build will load.
OpenGL the Java Way
Let's look at how OpenGL graphics are done in Java. You'll start by creating a project
for your sample application. Then you'll look at the classes that make up the project: the
main activity used to launch the app, the surface view used to render graphics, the GL
thread used to perform drawing operations in the background, the cube renderer used to
draw the actual cube, and the cube class that has information such as dimensions, color,
and others.
 
Search WWH ::




Custom Search