Aim control, 219
AL (Audio Library), 269
Android activity, 21, 43–44, 46, 64, 81
Android class, 48
Android interface, 131
Android method, 141
Android toolbar, 11
Android Virtual Devices (AVDs), 10–14, 16
APK (Application Package), 263
applications
key store, 262
architecture, game
for Doom, 151
game startup activity, 214–216
handling audio independently of format, 207–210
handling keyboard events, 210–212
handling touch events, 212–214
Java OpenGL renderer architecture, 202–207
attaching, to shaders, 119
Audio Library (AL), 269
AVDs (Android Virtual Devices), 10–14, 16
Bluetooth controllers, Zeemote joystick, 53–58
BluetoothAdapter.getDefaultAdapter( ) method, 58
C arrays
converting Java arrays to, 268
converting Java string arrays into, 32
C/C++ event handling, Java wrappers for, 38–48
C language
defining variable-arguments functions in, 33–34
invoking Java language within, 269
C to Java callbacks, for Doom, 167, 174–180
fatal errors, 180
graphics initialization, 174–175
sound and music callbacks, 176–177
video buffer callback, 176
Call method, 29
callback listener, for Doom, 165–166
callbacks, 269
key events, 46
renderers
mixed or hybrid, 44
cbb.asIntBuffer( ) method, 79
cbb.order.ByteOrder.nativeOrder( ) method, 79
converting Java array to C array, 268
invoking Java language within C language, 269
loading Java class as global reference, 268
method syntax, 268
chooseConfig( ) method, 131
Compilation file, 34
Android project with native support, 21–22
application architecture, 23–34
icosahedron project, 143
with NDK
ConfigChooser class, 128
config.getButtonCount( ) method, 57
config.getJoystickCount( ) method, 57
connect( ) method, 56
ContextFactory class, 128
ContextFactory( ) method, 128
controllerUi.startConnectionProcess( ) method, 56
CreateGlEsInterface( ) method, 200
cube file, native, 93
native interface function, 92–93
scene initialization, 87
Cube_draw( ) method, 88–91, 94
CubeRenderer.drawFrame( ) method, 87, 89
CubeRenderer.surfaceCreated( ) method, 87
Cygwin tool, 10
Bluetooth controllers, Zeemote joystick, 53–58
Android project with native support, 21–22
application architecture, 23–34
Java wrappers for C/C++ event handling, 38–48
MultiTouchGesture class, 48–50
native cube file, 93
shared library, compiling, 34–35
devices
testing applications on, 35–37
doNativeDraw( ) method, 86
C to Java callbacks, 167, 174–180
fatal errors, 180
graphics initialization, 174–175
sound and music callbacks, 176–177
video buffer callback, 176
commenting SDL occurrences, 182–183
inserting fatal error callback, 182
sound system changes, 183
game architecture for, 151
handling audio independently of format, 164–165
audio request handlers, 161
creation handler, 152
graphics initialization handler, 159
key and touch event handlers, 157–158
menu and selection handlers, 155–156
message updates, 160
native interface class, 165–167
native methods, 166
native method implementations, 170–180
key and motion events, 173
native game loop, 171
overview, 149
drawFrame( ) method, 75, 86–87, 89–90, 93
EAS (Enhanced Audio System), 269
Eclipse platform, configuring, 2–9
e.getAction( ) method, 50, 139, 212
e.getPointerCount( ) method, 50–51, 139
e.getX( ) method, 212
e.getY( ) method, 212
EGL (Embedded OpenGL), 72
eglChooseConfig( ) method, 121
EGLContext class, 80
EGLContext.getEGL( ) method, 80
egl.eglGetError( ) method, 129
EglHelper( ) method, 73
Embedded OpenGL (EGL), 72
Embedded System (ES), 60
emulators
Enhanced Audio System (EAS), 269
Eclipse platform, configuring, 2–9
SDK, downloading and installing, 2
e.printStackTrace( ) method, 25, 68, 82
ES (Embedded System), 60
ES interface, 201
e.toString( ) method, 40, 157–158, 161, 163, 168, 211
event.getAction( ) method, 47, 158
event.getButtonID( ) method, 57
event.getController( ) method, 56–57
event.getCurrentLevel( ) method, 56
event.getMaximumLevel( ) method, 56
event.getMinimumLevel( ) method, 56
event.getWarningLevel( ) method, 56
evt.getAction( ) method, 162–164
ex.printStackTrace( ) method, 73
fatal errors, handling for Quake II, 245–248
FPS (frames per second), 45
Fragment Shader Language (FSL), 115–117
fragment shaders, 114
frames per second (FPS), 45
FSL (Fragment Shader Language), 115–117
game architecture
for Doom, 151
game startup activity, 214–216
handling audio independently of format, 207–210
handling keyboard events, 210–212
handling touch events, 212–214
Java OpenGL renderer architecture, 202–207
game layout, for Doom, 152–155
GameFileDownloader class, 151
G_CheckDemoStatus( ) method, 182
geometry shaders, 115
getConfigSpec( ) method, 75–76
geteuid( ) method, 239
getEvent( ) method, 73
getHolder( ) method, 68–69, 71
getSurfaceHolder( ) method, 69
getWindow( ) method, 52, 152, 215
getWindowManager( ) method, 52, 127, 215
glCreateProgram( ) method, 118, 135–136
glEnableClientState( ) method, 89
GLES interface, 197
glFlush( ) method, 218
gl.glLoadIdentity( ) method, 74, 76–77, 89
glLoadIdentity( ) method, 74, 89–90
global references, loading Java classes as, 268
gl*Pointer( ) method, 78
GLSL (OpenGL ES 2.0 Shading Language), 115
GLSwapBuffers( ) method, 84–85, 87
GLThread.surfaceCreated( ) method, 68
GLThread.surfaceDestroyed( ) method, 69
gl_unimplemented( ) method, 197
GPU (Graphics Processing Unit), 43, 60
g.reset( ) method, 51
hybrid renderers, 44
hybrid scaling, with Open GL API, 99–111
initializing surface, 102
when image is not power of two, 106–111
I (integer), 31
activity, 127
compiling, 143
configuration chooser, 131–133
project shaders, 134
setting rotation speed, 138–139
swiping to change rotation speed, 139–142
images, hybrid scaling when not power of two, 106–111
ImageView.getLayoutParams( ) method, 159
immediate mode drawing, OpenGL ES vs. OpenGL, 195–196
init( ) method, 69
InitGLStructs( ) method, 197, 199
integer (I), 31
I_ShutdownGraphics( ) method, 182
item.getItemId( ) method, 156
Java arrays
converting string of into C array, 32
converting to C array, 268
getting size of, 33
Java/C combo, and Doom for Android, 146–147
Java class, 20, 27, 40, 61, 92, 180, 221, 236, 247, 268
Java heap, and Quake II, 234–235
Java language
invoking static void method, 33
invoking within C language, 269
Java main activity, for Doom, 151–163
audio request handlers, 161
creation handler, 152
graphics initialization handler, 159
key and touch event handlers, 157–158
menu and selection handlers, 155–156
message updates, 160
Java method, 19, 23, 33, 46, 89, 103, 169, 176, 237, 245
Java Native Interface. See JNI
Java Virtual Machine (JVM), 30
Java wrappers, for C/C++ event handling, 38–48
JavaGLActivity.onCreate( ) method, 67
JIT (Just in Time), 38
JNI (Java Native Interface), cheat sheet, 267–269
converting Java array to C array, 268
invoking Java language within C language, 269
loading Java class as global reference, 268
method syntax, 268
jni.Natives.LibMain( ) method, 33
jni.Natives.OnMessage( ) method, 37
Just in Time (JIT), 38
JVM (Java Virtual Machine), 30
key events, 46
key stores, 262
libraries
listener.GLSwapBuffers( ) method, 85
MAC (message authentication code), 54
main activity
mEglHelper.finish( ) method, 73–74
mEglHelper.swap( ) method, 74, 87
message authentication code (MAC), 54
method syntax, JNI, 268
mGLSurfaceView.onPause( ) method, 68, 83
mGLSurfaceView.onResume( ) method, 68, 83
mGLThread.onPause( ) method, 70
mGLThread.onResume( ) method, 70
mGLThread.requestExitAndWait( ) method, 71
mGLThread.start( ) method, 70–71, 86
mGLThread.surfaceCreated( ) method, 70
mGLThread.surfaceDestroyed( ) method, 70
mixed renderers, 44
MotionEvent type, 141
mRenderer.getConfigSpec( ) method, 73
mTrack.play( ) method, 40, 208
MultiTouchGesture class, 48–50
MultiTouchGesture class, 48–50
MultiTouchGesture.eGestureType type, 49
mView.getLayoutParams( ) method, 159
MyApp( ) method, 20
NanoGL interface, 200
nanoGL_Destroy( ) method, 199–200
nanoGL_Init( ) method, 199–200, 217, 249
Native activity, 83
native cube file, 93
native interface function, 92–93
scene initialization, 87
Bluetooth controllers, Zeemote joystick, 53–58
Android project with native support, 21–22
application architecture, 23–34
Java wrappers for C/C++ event handling, 38–48
MultiTouchGesture class, 48–50
native cube file, 93
shared library, compiling, 34–35
Native Development Kit (NDK), installing, 9–10
native interface class
native methods, 166
native interface function, 92–93
defining variable-arguments function in C language, 33–34
invoking Java static void method, 33
Java arrays
converting string of into C array, 32
getting size of, 33
Native method, 169
NativeAudio class, 209
NativeAudio.start( ) method, 204, 209, 245, 252
Natives class, 28, 30, 33, 91, 170–171, 205
Natives.EventListener interface, 158
Natives.java class, 237
Natives.NativeRender( ) method, 86
Natives.OnMessage method, 33
Natives.RenderFrame( ) method, 203
navigation controls, for Doom, 162–163
NDK, compiling with, Doom for Android, 187–189
NDK (Native Development Kit), installing, 9–10
OnCloseAudio( ) method, 40, 42
onDestroy( ) method, 72
onDetachedFromWindow( ) method, 70–71
OnImageUpdate( ) method, 172
onResume( ) method, 68, 70, 83
OnUnLockAudio( ) method, 41
Open GL API
initializing surface, 102
when image is not power of two, 106–111
native cube file, 93
OpenGL ES
floating point issues, 196
immediate mode drawing, 195–196
OpenGL ES 1.x, vs. OpenGL ES 2.0, 120–121
fragment shaders, 114
geometry shaders, 115
GLSL, 115
activity, 127
compiling, 143
configuration chooser, 131–133
project shaders, 134
setting rotation speed, 138–139
swiping to change rotation speed, 139–142
attaching to shader, 119
getting link status, 119
linking shader program, 119
program validation and status, 120
using program, 120
vertex shaders, 114
VSL, 115
OpenGL ES 2.0 Shading Language (GLSL), 115
OpenGL immediate mode, and Quake II, 248
OpenGL interface, 200
opengl.jni.Natives.NativeRender( ) method, 92
performance, of Quake II, 258–259
pinching to zoom, icosahedron project, 139–142
PixelFormat class, 69
preloadSounds( ) method, 164
projects, icosahedron, 121–139
activity, 127
compiling, 143
configuration chooser, 131–133
project shaders, 134
setting rotation speed, 138–139
swiping to change rotation speed, 139–142
Pure Hardware renderers, 44–45
qglFlush( ) method, 252
audio handler changes, 220–221
handling forward and side movement, 220
handling pitch and yaw, 219–220
video handler changes, 216–218
game startup activity, 214–216
handling audio independently of format, 207–210
handling keyboard events, 210–212
handling touch events, 212–214
Java OpenGL renderer architecture, 202–207
floating point issues, 196
immediate mode drawing, 195–196
handling key events, 241
rendering single frame, 238–241
handling fatal errors, 245–248
OpenGL immediate mode issues, 248
running on device or emulator, 255–258
setting video mode and size, 249–252
video initialization, 249
when rendering completes, 252
QuakeRenderer( ) method, 203
Renderer interface, 63–64, 67, 74
renderers
mixed or hybrid, 44
RenderFrame( ) method, 205–206, 224–225, 237–240
requestFocus( ) method, 203
reset( ) method, 49
r.run( ) method, 73
run( ) method, 40, 46, 72, 129, 160–161, 208, 210–212
Runnable( ) method, 40, 46, 129, 160–161, 208, 210–212
running
in emulator, Quake II, 255–258
initializing surface, 102
when image is not power of two, 106–111
scenes, initializing, 87
SD Card, 13
SDKs (Software Development Kits), downloading and installing, 2
sEglSemaphore.acquire( ) method, 71–72
sEglSemaphore.release( ) method, 71, 73
seteuid.getuid( ) method, 239
setGameUI( ) method, 152
setRenderer( ) method, 71
setupPanControls( ) method, 152, 163
attaching to, 119
getting link status, 119
linking program, 119
program validation and status, 120
using program, 120
ShadersActivity class, 139
ShadersView object, 127
Software Development Kits (SDKs), downloading and installing, 2
static void method, Java language, invoking, 33
string arrays, Java, converting into C array, 32
super( ) method, 72
super.onDetachedFromWindow( ) method, 70
super.onPause( ) method, 68, 83
super.onResume( ) method, 68, 83
surfaceCreated( ) method, 69
SurfaceHolder.addCallback( ) method, 68
surfaces, initializing, 102
swapBuffers( ) method, 74
SysError( ) method, 206
System class, 207
System.currentTimeMillis( ) method, 130
testing in emulator, Doom for Android, 189–191
textures, drawing into, 103–106
t.start( ) method, 41
UI (user interface), 192
user interface (UI), 192
variable-arguments functions, defining in C language, 33–34
vbb.asIntBuffer( ) method, 79
vbb.order.ByteOrder.nativeOrder( ) method, 78
Vertex Shader Language (VSL), 115
vertex shaders, 114
video, cascading events, 43–48
key events, 46
video handlers, for Quake II, 248–252
setting video mode and size, 249–252
video initialization, 249
when rendering completes, 252
View.OnTouchListener( ) method, 162–163
ViewRenderer( ) method, 128–129
VSL (Vertex Shader Language), 115
wait( ) method, 73
XML file, 126
zee.connect( ) method, 58
Zeemote class, 58
3.22.77.30