On the left the multimedia menu and the mapping application of Nokia N95; on the right, a mobile game.. Images Copyright c 2007 Nokia Corporation.. Image copyright c Kishonti Informati
Trang 1434 INDEX
reflectance (Continued)
diffuse, 66–67
specular, 67–68
reflection models, 64–65
ambient reflectance, 65–66
diffuse reflectance, 66–67
specular reflectance, 67–68
registers, 408
rendering
asynchronous multibuffered, 103
into textures, 254–255
layers, 132, 360–361
level-of-detail, 151
low-level, 55–103
multi-pass, 98–99
order, 149
portal, 150
primitives, 57–61
retained mode, 128–132
sprite, 347–348
state, 130, 132
synchronized, 102–103
transparent objects, 97–98
render methods, 296
render targets, 290–293
antialiasing, 292
binding, 291
disabling depth buffer, 292–293
dithering, 292
minimizing number of, 291
synchronizing 2D and 3D, 291–292
REPLACE function, 80
retained-mode objects, 272
retained mode rendering, 128–132
camera/light setup, 129–130
defined, 128, 294
display lists, 128
state, resolving, 130
RGBA format, 80
root objects, 312
rotation interpolation, 285–286
rotations, 36–38
defined, 36
illustrated, 36
Transformable, 304–305
S
Safety-Critical (SC) profile, 161
scalability, 134–136
background elements, 136
detail objects, 136 special effects, 135–136 texture mapping, 134 Scalable Vector Graphics (SVG), 22 scalar product, 29, 30
scale orientation, 305 scaling
downscaling, 134 matrix, 38 uniform, 38 scene graph objects, 272 scene graphs (M3G), 349 –366 basics, 349–351
groups, 350–351 layering, 360–361 Mesh objects, 351–354 multi-pass effects, 361–362 Node objects, 349–350 object transformation, 354–360 performance optimization, 364–366 picking, 362–364
World, 351 scene graphs (OpenGL ES), 120 –128 application area, 120–121 class hierarchy, 125–128 content creation, 123–125 defined, 120
example, 275 extensibility, 125 nodes, 273 Performer by SGI, 128 spatial data structure, 121–123 scene management, 117–132 scissor test, 92–93, 214 scope masks, 365–366 defined, 365 example, 366 screen linear interpolation, 82–83 scrolling backgrounds, 344–345 separate specular pass, 335–337 sequence time, 375
setters setActiveCamera, 356 setAlignment, 358, 359 setAlphaThreshold, 348 setAppearance, 352 setAttenuation, 341 setBlending, 334 setColor, 320, 328, 333, 341, 343 setCrop, 344, 347
setCulling, 327
setDefaultColor, 322 setDepth, 343 setDepthRange, 294 setDuration, 370 setGeneric, 338 setImage, 344 setImageMode, 344 setIntensity, 341 setKeyframe, 369 setLight, 341 setLinear, 333 setMode, 332 setNormals, 320 setParallel, 337 setPerspective, 338 setPickingEnable, 363 setPositions, 320, 321 setScope, 365 setSpeed, 376 setTexCoords, 320, 322 setTranslation, 306 setTwoSidedLightingEnable, 327 setValidRange, 369
setWeight, 376 setWinding, 327 shading
accessibility, 86 flat, 64, 193 Gouraud, 64, 193 model, changing, 193 OpenGL ES support, 193 Phong, 64
shallow copy, 308 shared exponents, 397–399 shearing, 38
shininess power, 68
sin, 399–400
single buffering, 101 skinned characters, 381–385 attaching skin, 383–385 build example, 381–383 combining morphing/skinning, 385 connecting bones, 383–384 illustrated, 382
SkinnedMesh class, 353 construction, 384 nodes, 384 object, 368 skinning, 20, 114–116 animation from, 115–116
as de facto standard, 114
Trang 2INDEX 435
defined, 114
hardware-accelerated, 115
with matrix palette extension,
235–238
morphing combined with, 385
skeleton hierarchy, 114
smart phones, 4, 7
special effects, scalability, 135–136
specular reflectance, 67–68
defined, 67
geometry, 67
spherical environment mapping, 86, 87
spherical linear interpolation
(slerp), 112
spline interpolation, 387
spot lights, 69
Sprite3D class, 346–348
defined, 346
sprite image specification, 347
use cases, 346
sprites
Appearance attributes, 347
compositing, 347–348
creating, 346–347
functions, 346–347
M3G support, 61
rendering, 347–348
squad, 112
squared exponential (EXP2) fog, 89
state, 132
changes, optimizing, 146
changing, 145–146
querying, 145–146
resolving, 130
sorting, 132
state machine model, 168
static lighting, 151
static properties, 296–297
stencil buffers, 216
stencil test, 93–94, 215–217
defined, 215
enabling, 215
example, 216–217
See also fragments
stippling, 176
stride parameter, 177, 178
subdivision surfaces, 59
submeshes, 352
Appearance, changing, 352
number of, 352
vertices, sharing, 352
suffixes, 167–168 supersampling, 91 surfaces, 248–252 attributes, 251 binding commands, 257 defined, 248
double-buffered, 249 pbuffer, 248–249, 250 pixmap, 249, 258 window, 248 SVG Basic, 22 SVG Tiny, 22 synchronization 2D/3D points, 291–292 points, 102–103 sequence, 386–387
T
tags, 308–310 target cameras, 359–360 technical support, OpenGL ES, 160 temporal aliasing, 92
Texture2D class, 329–332 texture-based lighting, 83–88 ambient occlusion, 86 approaches, 84–85 environment mapping, 86–88 light mapping, 85
projective lighting, 85–86
See also lighting
texture combiners, 207–209 defined, 207
use example, 208 texture coordinates, 75–76 rotation, 188
transformation, 186–188 values less than zero, 76 wrapping modes, 76 texture data, specifying, 197–202 texture filtering, 76–78, 202–205 anisotropic, 78
bilinear, 78
as expensive operation, 204 illustrated, 77
mipmap modes, 204–205 mipmap specification, 203–204 modes, 203
texture images, 329–330 texture mapping, 60, 74, 74–82, 196–210
hardware implementation, 152 illustrated, 75
scalability, 134 software implementation, 152 texture coordinates, 75–76 texture matrix, 183 manipulation code example, 187 transformation, 186
texture objects, 196–197 texture names, 196 use pattern, 197 textures, 152–154 borders, 78–79 combiner functions, 80–81 combining, 153
compressed formats, 200–202 formats, 79–80, 198 functions, 79–80, 81, 205–206 image data, 153
light map, 331 OpenGL ES, 163 rendering into, 254–255 sampling, 330 storage, 152–154 wrap modes, 205 texture transformations, 332 texturing
point sprite, 209 units, 165, 207 Transformable class, 303–306 defined, 303
false entries, 317 methods, 303–304 pivot transformations, 305–306 rotations, 304–305
transformation(s) affine, 35–42 around pivots, 39 camera, 338–339 compound, 33–34 hierarchies, 121, 149 modelview, 339 node, 354–355 normal vectors, 34–35, 185–186 object, 354–360
OpenGL ES, 163 pivot, 305–306 rigid, 38 rotation, 36–38 scaling, 38 shearing, 38
Trang 3436 INDEX
transformation(s) (Continued)
texture, 332
texture coordinate, 186–188
texture matrix, 186
translation, 36
viewing, 355–356
viewport, 183, 188–189
transformation pipeline, 148–151
culling, 150–151
object hierarchies, 148–149
rendering order, 149
Transform class, 272, 283, 300–302
defined, 300
initializing, 300–301
matrix creation, 301
matrix multiplication functions, 301
matrix operations, 301
methods, 302
use cases, 302
vertices transformation, 302
translation, 36
transparent objects, 97–98
transpose operation, 31
triangle data, 148
triangle meshes, 118–120
appearance, 118
components, 118
defined, 118
object coordinates, 119
vertex arrays, 119
triangles, 57
definition methods, 176
fan, 176
index array, 148
mesh, 58
planar, 63
separate, 176
sorting, 148
TriangleStripArray class, 323
triangle strips, 176, 323, 324
trigonometric operations, 399–400
TRUE COLOR hint, 292
two-sided lighting, 192
type-checking, 412
type parameter, 177
typographic conventions, this book, 3
U
user clip planes, 165, 189
V
vectors cross product, 30 dot product, 29, 30 normal, 34–35, 63–64 products, 29–30 scalar product, 29, 30 transforming, 34–35 vendor-specific extensions, 166 VertexArray class, 283, 318, 319–320 defined, 319–320
get method, 320 vertex arrays binding VBOs to, 182 defined, 177 delta encoding, 318 packed data, 178 sizes, 178 stride and, 178 supported types, 321 VertexBuffer class, 282, 320–323 constructor, 320
setters, 320–321 vertex buffer objects (VBOs), 129 ,
164, 180–183 array indices in, 182–183 binding to vertex attribute array, 182 creation, 180–181
defined, 180 list, 181 vertex data, 147–148, 162 format, 178
specifying, 177–179 vertex ordering, 192 vertex pipeline, 139–140 vertex shaders, 116 vertex transformation pipeline, 183–189 illustrated, 183 matrices, 183–185 matrix stacks, 188 texture coordinate transformation, 186–188 transforming normals, 185–186 user clip planes, 189
viewport transformation, 188–189 vertices, 173
defined, 29 dynamically uploaded data, 116 positions, 322
submesh sharing, 352
transforming, 302 view frustum, 47–50 asymmetric, 48 clipping to, 72 culling, 71–73 defined, 45 eye coordinate system, 45 general, definition, 48 viewport, 293–294 depth range and, 294 maximum size, 294 transformation, 183, 293 Vincent, 160
virtual machines, 408–409 ahead-of-time (AOT) tactic, 409 approaches, 408
interpretation, 408 just-in-time (JIT) compilers, 408 visibility optimization, 364–365 visibility processing, 121, 122
W
water simulation, 116 window surfaces
as best performing, 256
in control, 257–258 defined, 248
See also surfaces
Wireless Messaging API (JSR 120), 271 word-aligned packing, 225
world time, 375, 376
X
XOR operation, 100
Z
Z axis, 357, 360 alignment, 357 negative, 359 positive, 359 z-buffer, 45 z-fighting, 47, 94 zTarget, 357
Trang 4C O L O R P L A T E 1: (Figure 1.5) Uses of OpenGL ES in the Nokia N95 multimedia computer On the left the multimedia menu and the mapping application of Nokia N95; on the right, a mobile game Images Copyright c
2007 Nokia Corporation.
C O L O R P L A T E 2: (Figure 1.6) Screen shot from the GLBenchmark benchmarking suite for OpenGL ES Image copyright c Kishonti Informatics LP.
Trang 5C O L O R P L A T E 3: (Figure 1.7) More 3D user interface examples Images copyright c Acrodea.
C O L O R P L A T E 4: (Figure 1.8) 3D user interface examples Images copyright c TAT.
Trang 6C O L O R P L A T E 5: (Figure 1.9) A VGA resolution screen shot from 3DMark Mobile 06, and OpenGL ES benchmark program Image copyright c Futuremark.
C O L O R P L A T E 6: (Figure 1.10) Demonstrating some of the advanced shading capabilities made possible by OpenGL ES 2.0 Images copyright c AMD.
Trang 7C O L O R P L A T E 7:(Figure 1.11) Java games using M3G Images copyright c Digital
Chocolate.
C O L O R P L A T E 8:(Figure 1.12) Screen shot from the Jbenchmark performance bench-marking suite for M3G Image copyright c Kishonti Informatics LP.
Trang 8C O L O R P L A T E 9:(Figure 3.2) Illustrating the various stages of shading discussed in Chapters 3 and 8–10.
Top row, left to right: wire frame model; filled model; diffuse lighting; diffuse and Phong specular lighting Bottom row: texturing added; texturing with a separate specular pass; bump mapping added; and rendered with
an intersecting translucent object to demonstrate Z-buffering and alpha blending.
1
C O L O R P L A T E 10: (Figure 3.14) Rendering a light bloom effect by blurring the highlights and compositing on top of the normal scene Images copyright c AMD.
Trang 9C O L O R P L A T E 11:(Figure 3.15) The effect of different texture functions Top: incoming fragment colors (left) and texture (right); transparency is indicated with the checkerboard pattern behind the image Bottom: resulting textures after each texture operation; left to right:
REPLACE,MODULATE,DECAL,BLEND,ADD For theBLENDmode, the user-defined blending color
is pure yellow.
C O L O R P L A T E 12: (Figure 3.17) Several passes of a scene: bump mapping, projective lighting (using the circular light map on left middle), adding environment map reflection to the barrel (the cube map at left bottom), adding shadows, final image Image copyright c
AMD.
Trang 10C O L O R P L A T E 13: (Figure 3.19) An environment cube map (right) and refraction map (center) used to render
a well Image copyright c AMD.
C O L O R P L A T E 14:(Figure 6.11) An example of automatically packing textures into a texture atlas (refer to Section 6.7.1) Image courtesy of Bruno Levy.