Index

. (dot), vector access operator, 101โ€“102

#elif directive, 116

#else directive, 116

#error directive, 116

#extension directive, 116

#if directive, 116

#pragma directive

definition, 116

enabling global invariance, 123

[ ] (square brackets), array subscript operator, 101โ€“102

2D texture arrays

loading, 260โ€“262

new features, 11

overview, 230

2D textures

attached to framebuffer objects, 338โ€“339

base formats, 227

overview, 226โ€“227

in shaders, 255โ€“257

3D textures

attached to framebuffer objects, 339โ€“340

loading, 260โ€“262

new features, 12

overview, 229

3D textures, noise

dust effects, 403โ€“404

water wave simulation, 404

wispy fog, 402โ€“404

A

abs function, 467

acos function, 465

acosh function, 466

Advanced RenderMan: Creating CGI for Motion Pictures, 407

Aliasing artifacts. See Anti-aliasing; Mipmapping.

all function, 473

Alpha test, 291โ€“293

Android 4.3 (API 18), 451

Android NDK, 451

Android SDK, 451

Angles, built-in functions, 465โ€“466

Animation, 2D images. See 2D texture arrays.

Anti-aliasing

multi-sampled, 314โ€“316

procedural textures, 407โ€“410

any function, 473

Apache Ant, 451

ARM Mali OpenGL ES Emulator, 448

Array buffer objects, 140โ€“141

Arrays, 104

Arrays of structures, 128. See also Structures.

asin function, 465

asinh function, 466

Asynchronous objects, querying, 442โ€“443

atan function, 465

atanh function, 466

Attributes. See also specific attributes.

active, counting, 77

active, querying, 93

getting, 92โ€“93

largest name, getting, 77

setting, 92โ€“93

B

Back buffers, 41, 298

Backward compatibility, 17โ€“18

Bias matrix, 392โ€“393

Binaries. See Program binaries.

Binding

program objects, example, 39

renderbuffer objects, 330โ€“331

texture objects, 231

vertex array objects, 151

vertex attributes, 137โ€“140

vertex buffer objects, 141

Blend equations, new features, 17

Blending

colors, 311โ€“314

per-fragment operations, 10

Blur effects, 387โ€“390

Boolean occlusion queries, new features, 15

Buffer object to buffer object copies, new features, 16

Buffer objects

copying, 159โ€“160

deleting, 150

drawing with and without, 145โ€“150

initializing, 145

updating, 145

Buffer objects, mapping

changing screen resolution, 157

data storage pointer, getting, 155โ€“156

flushing mapped buffers, 158โ€“159

overview, 154โ€“155

unmapping, 155โ€“156

Buffer objects, new features. See also Uniform buffer objects; Vertex buffer objects.

buffer object to buffer object copies, 16

buffer subrange mapping, 16

pixel buffer objects, 16

sampler objects, 16

sync objects, 16

uniform buffer objects, 16

vertex array objects, 16

Buffer subrange mapping, new features, 16

Buffer write masks, 301โ€“303

Buffers, fragments. See also Pbuffers (pixel buffers).

back, 298

buffer write masks, 301โ€“303

clearing, 299โ€“301

depth of, 298

front, 298

making writable, 301โ€“303

requesting, 299

size of, 298

swapping, 298โ€“299

types of, 298

Built-in functions. See also Functions.

abs function, 467

acos, 465

acosh, 466

all, 473

angles, 465โ€“466

any, 473

asin, 465

asinh, 466

atan, 465

atanh, 466

ceil, 468

clamp, 469

cos, 465

cosh, 466

cross, 473

degrees, 465

description, 107

determinant, 473

dFdx, 484

dFdy, 484

distance, 473

dot, 473

equal, 473

exp, 466

exp2, 466

exponential, 466โ€“467

faceforward, 473

floatBitsToInt, 470

floatBitsToUInt, 470

floating-point pack and unpack, 471โ€“472

floor, 467

fract, 468

fragment processing, 483โ€“484

fwidth, 484

geometric, 472โ€“473

greaterThan, 475

greaterThanEqual, 475

intBitsToFloat, 470

inverse, 474

inversesqrt, 467

isinf, 470

isnan, 470

length, 473

lessThan, 475

lessThanEqual, 475

log, 466

log2, 467

matrix, 474

matrixCompMult, 474

max, 468

min, 468

mix, 469

mod, 468

new features, 15

normalize, 473

not, 475

notEqual, 475

outerProduct, 474

packHalf2x16, 472

packSnorm2x16, 471

pow, 466

radians, 465

reflect, 473

refract, 473

round, 468

roundEven, 468

sign, 467

sin, 465

sinh, 466

smoothstep, 470

sqrt, 467

step, 470

tan, 465

tanh, 466

texture built-in, 478

texture lookup, 476โ€“482

textureGrad, 481

textureGradOffset, 481

textureLod, 479

textureOffset, 480

textureProj built-in, 479

textureProjGrad, 482

textureProjGradOffset, 482

textureProjLod, 480

textureProjLodOffset, 480

textureSize, 478

transpose, 474

trigonometry, 465โ€“466

trunc, 467

uintBitsToFloat, 470

unpackHalf2x16, 472

unpackSnorm2x16, 471

unpackUnorm2x16, 471โ€“472

vector relational, 475

C

ceil function, 468

centroid keyword, 115

Centroid sampling, 14, 316

Checkerboard example, 405โ€“407

clamp function, 469

Client space, 126

Clip panes, user, 293โ€“295

Clipping

description, 176โ€“177

lines, 177

point sprites, 177

triangles, 177

Color

blending, 311โ€“314

color depth, simulating, 314

depth, simulating, 314

dithering, 314

fragments, 311โ€“314

specifying for multiple render targets, 321โ€“322

Color buffers

clearing, example, 39โ€“40

fragment operations, 298โ€“299, 302. See also Fragments, buffers.

column_major qualifier, 110

Combining texture maps, 286โ€“287

Command syntax, 20โ€“21

Compiling shaders, example, 36โ€“38

Compressing textures, 262โ€“265

Compression formats, textures, 264โ€“265

Conditional statements. See Control flow statements.

Conditional tests, preprocessor directives, 115โ€“117

const declarations, examples, 102โ€“103

Constant store, 109

Constants, description, 102โ€“103

Constructors. See Variable constructors.

Control flow statements, 107โ€“108

Coordinate systems

clipping, 176โ€“177

guard band region, 177

overview, 175

Copying

buffer objects, 159โ€“160

pixels in framebuffer objects, 342โ€“344

textures from the color buffer, 269โ€“273

cos function, 465

cosh function, 466

Creating

EGL windows, 53โ€“56, 64โ€“65

EGLContexts, 60โ€“62

fragment shaders, example, 35โ€“36

pbuffers, 56โ€“60

program objects, example, 38โ€“39

renderbuffer objects, 329โ€“330

rendering context, 60โ€“62

shaders, example, 35โ€“36

sync objects, 358โ€“359

texture objects, 230

vertex array objects, 144, 151

vertex buffer objects, 141

vertex shaders, example, 35โ€“36

windows, example, 34โ€“35

cross function, 473

Cubemaps

example, 205โ€“206

seamless filtering, new features, 12, 241

texturing, example, 258โ€“260

Culling, 7, 180โ€“181

Cygwin, 451

D

Data types

EGL, 20โ€“21

matrix, 99โ€“100

scalar, 99โ€“100

type conversion, 100

vector, 99โ€“100

Deferred shading, multiple render targets, 320โ€“321

Degenerate triangles, 172

degrees function, 465

Deleting

buffer objects, 150

framebuffer objects, 346โ€“347

program objects, 75

renderbuffer objects, 346โ€“347

shaders, 70

sync objects, 358โ€“359

texture objects, 230โ€“231

vertex array objects, 154

Deletion status, querying, 77

Depth buffer test, 311

Depth buffers

attached to framebuffer objects, 337โ€“338

sharing, 329

Depth buffers, fragment operations. See also Fragments, buffers.

buffer write masks, 302โ€“303

description, 298โ€“299

Depth-of-field. See Rendering, to textures.

Depth test, per-fragment operations, 10

Depth texture compare, 245โ€“246

Depth textures, 12, 254โ€“255

determinant function, 473

dFdx function, 484

dFdy function, 484

Directional light, example, 199โ€“202

Directives. See Preprocessor directives.

disable behavior, 117

Displacement mapping, vertex shaders, 214โ€“215

distance function, 473

Dithering, 10, 314

Dot (.), vector access operator, 101โ€“102

dot function, 473

Double buffering, example, 41

Drawing fragments, example, 35โ€“36

Drawing primitives

example, 40โ€“41

geometry instancing, 169โ€“172

multiple disconnected primitives, 168โ€“169

multiple primitives, different attributes, 169โ€“172

overview, 165โ€“168

performance tips, 172โ€“174

primitive restart, 168โ€“169

provoking vertex, 168โ€“169

Drawing surface, creating, 325โ€“327. See also FBOs (framebuffer objects).

Dust effects, 403โ€“404

Dynamic reflections. See Rendering, to textures.

E

EGL

command syntax, 20โ€“21

data types, 20โ€“21

description, 19

display server, connecting to, 44โ€“45

include files, 20

initializing, 44, 46

libraries, 20

programming with OpenGL ES 3.0, 20

rendering context, creating, 19

rendering surfaces, creating, 19

EGL error codes

EGL_BAD_ALLOC, 55, 58

EGL_BAD_ATTRIBUTE, 48, 51, 58

EGL_BAD_CONFIG, 55, 58, 61

EGL_BAD_DISPLAY, 46

EGL_BAD_MATCH, 55, 58

EGL_BAD_NATIVE_WINDOW, 55

EGL_BAD_PARAMETER, 47, 58, 67

EGL windows, creating

description, 53โ€“56

with the esUtil library, 65โ€“66

eglChooseConfig function, 51โ€“53

EGLConfig data type

choosing surface configurations, 51โ€“53

creating pbuffers, 56โ€“60

determining available surface configurations, 46โ€“47

EGLConfig data type, attributes

querying, 48โ€“50

specifying, 51โ€“52

summary of, 49โ€“50

EGL_CONTEXT_CLIENT_VERSION attribute, 61

EGLContexts

associating with an EGLSurface, 62โ€“63

creating, 60โ€“62

making current, 62โ€“63

EGL_CORE_NATIVE_ENGINE, 67

eglCreateContext function, 60โ€“62

eglCreatePbufferSurface command, 56โ€“60

eglCreateWindowSurface function, 53โ€“56

EGLDisplay data type, 44โ€“45

eglGetConfigs function, 47

eglGetDisplay function, 44โ€“45

eglGetError function, 45

EGL_HEIGHT attribute, 57

EGL_LARGEST_PBUFFER attribute, 57

eglMakeCurrent function, 62โ€“63

EGL_MIPMAP_TEXTURE attribute, 57

EGL_NO_CONTEXT error, 58

EGL_NOT_INITIALIZED error, 46โ€“47

EGLSurface, 62โ€“63

eglSwapBuffers function, 41

EGL_TEXTURE_FORMAT attribute, 57

EGL_TEXTURE_TARGET attribute, 57

eglWaitClient function, 66โ€“67

EGL_WIDTH attribute, 57

Element buffer objects, 140โ€“141

Emulating OpenGL ES 3.0

ARM Mali OpenGL ES Emulator, 448

iOS 7, 453โ€“455

OpenGL ES 3.0 Emulator, 447โ€“449

PowerVR Insider SDK v 3.2+, 448

PowerVR OpenGL ES 3.0 Emulator, 449โ€“450

Qualcomm Adreno SDK v3.4+, 447

Ubuntu Linux, 449โ€“450

Windows, 447โ€“449

enable behavior, 116

Entity names, querying, 429โ€“435

Environment mapping

definition, 228, 370

example, 370

fragment shader, 372โ€“373

vertex shader, 370โ€“372

equal function, 473

Error checking, querying for error codes, 45

Error codes. See also specific codes.

querying for, 45

summary of, 23

Error handling, 22โ€“23

ES Framework API

core functions, 485โ€“489

esCreateWindow function, 34, 485โ€“486

esFrustrum function, 198, 490

esGenCube function, 489

esGenSphere function, 488

esGenSquareGrid function, 489

esLoadProgram function, 487โ€“488

esLoadShader function, 487

esLoadTGA function, 488

esLogMessage function, 489

esMatrixLoadIdentity function, 493

esMatrixMultiply function, 493

esOrtho function, 491

esPerspective function, 198โ€“199, 491

esRegisterDrawFunc function, 486

esRegisterKeyFunc function, 487

esRegisterShutdownFunc function, 487

esRegisterUpdateFunc function, 486

esRotate function, 492โ€“493

esScale function, 492

esTranslate function, 492

transformation functions, 490โ€“494

esCreateWindow function, 34, 485โ€“486

esFrustrum function, 198, 490

esGenCube function, 489

esGenSphere function, 488

esGenSquareGrid function, 489

esLoadProgram function, 487โ€“488

esLoadShader function, 487

esLoadTGA function, 488

esLogMessage function, 489

esMain function, 34

esMatrixLoadIdentity function, 493

esMatrixMultiply function, 493

esOrtho function, 491

esPerspective function, 198โ€“199, 491

esRegisterDrawFunc function, 486

esRegisterKeyFunc function, 487

esRegisterShutdownFunc function, 487

esRegisterUpdateFunc function, 486

esRotate function, 492โ€“493

esScale function, 492

esTranslate function, 492

esUtil library, creating EGL windows, 65โ€“66

ETC/EAC texture compression, 12, 264โ€“265

Example code. See also specific examples.

creating. See Hello Triangle.

downloading, 28โ€“29

exp function, 466

exp2 function, 466

Exponential built-in functions, 466โ€“467

Extension behaviors, 116โ€“117

Extensions, 116โ€“117

F

faceforward function, 473

FBOs (framebuffer objects). See also Renderbuffer objects.

attachment points, 336โ€“337

binding, 335โ€“336

blits, 342โ€“344

checking for completeness, 341โ€“342

copying pixels, 342โ€“344

creating, 329โ€“330

definition, 327

deleting, 346โ€“347

vs. EGL surfaces, 329

examples, 348โ€“354

invalidation, 344โ€“346

new features, 17

performance tips, 354

purpose of, 325โ€“327

querying, 445โ€“446

reading pixels, 347

vs. renderbuffer objects, 328

resolving multisample renderbuffers to textures, 342โ€“344

state values, 336

TBR GPUs, 345

FBOs (framebuffer objects), attachments

2D textures, 338โ€“339

3D textures, 339โ€“340

depth buffers, 337โ€“338

renderbuffer objects, 337โ€“338, 347

Fences, 358โ€“361

Filtering textures. See Texture filtering.

Flat/smooth interpolators, 14, 114

floatBitsToInt function, 470

floatBitsToUInt function, 470

Floating-point

numbers. See GL_HALF_FLOAT data type.

pack and unpack, built-in functions, 471โ€“472

texture formats, 249โ€“250

textures, new features, 12

floor function, 467

Fog effects. See also Particle systems.

linear fog, creating with a fragment shader, 288โ€“291

wispy fog, creating with noise, 402โ€“404

fract function, 468

Fragment depth, new features, 15

Fragment processing, built-in functions, 483โ€“484

Fragment shaders

2D texturing, 255โ€“257

built-in constants, 284โ€“285

built-in special variables, 283โ€“284

creating, example, 35โ€“36

examples, 9, 113โ€“114

fragment depth, overriding, 284

front-facing fragments, identifying, 284

input variables, 8

inputs, 8

inputs/outputs, 111โ€“114

maximum uniform blocks, querying, 91

MRTs (multiple render targets), minimum/maximum number of, 285

offsets, minimum/maximum, 285

overview, 8โ€“9, 282โ€“285

precision qualifiers, 285

samplers, 8

shader inputs, minimum/maximum number of, 284

shader program, 8

Shading Language version, specifying, 9

texture coordinates for point sprites, 284

texture image units, minimum/maximum number of, 285

uniforms, 8

vec4 uniform entries, minimum/maximum number of, 285

window coordinates of current fragment, 283โ€“284

Fragment shaders, fixed-function techniques

alpha test, 291โ€“293

combining texture maps, 286โ€“287

fog effects, 288โ€“291

multitexturing, 286โ€“287

pipeline description, 280โ€“282

transparent fragments, 291โ€“293

user clip panes, 293โ€“295

Fragments

blending pixel colors, 311โ€“314

centroid sampling, 316

color depth, simulating, 314

depth, overriding, 284

dithering, 314

front-facing, identifying, 284

MRTs (multiple render targets), 320โ€“324

multi-sampled anti-aliasing, 314โ€“316

pixel pack buffer objects, 320

pixels, reading and writing, 316โ€“320

rendered images, saving, 316โ€“320

sample coverage masks, 315

transparent, 291โ€“293

window coordinates of, 283โ€“284

Fragments, buffers

back, 298

buffer write masks, 301โ€“303

clearing, 299โ€“301

depth of, 298

double buffering, example, 41

front, 298

making writable, 301โ€“303

requesting, 299

size of, 298

swapping, 298โ€“299

types of, 298. See also specific types.

Fragments, tests

depth buffer test, 311

overview, 303โ€“304

scissor test, 304โ€“305

stencil buffer test, 305โ€“311

test enable tokens, 304

Framebuffer invalidation hints, 17, 344โ€“345

Framebuffer objects (FBOs). See FBOs (framebuffer objects).

Front buffers, 298

Frustrum, 7

Full integer support, new features, 14

Functions. See also Built-in functions; ES Framework API; specific functions.

description, 106

passing parameters to, 106

recursion, 106

fwidth function, 484

G

Gamma-correct rendering, new features, 11, 254. See also sRGB textures.

Geometric built-in functions, 472โ€“473

Geometry, new features, 15. See also Primitives.

Geometry instancing, 169โ€“172

GL_ACTIVE_ATTRIBUTE_MAX_LENGTH, 77

GL_ACTIVE_ATTRIBUTES, 77, 93

glActiveTexture function, 256

GL_ACTIVE_UNIFORM_ BLOCK_MAX_LENGTH, 77

GL_ACTIVE_UNIFORM_BLOCKS, 77

GL_ACTIVE_UNIFORM_MAX_LENGTH, 77

GL_ACTIVE_UNIFORMS, 77

GL_ARRAY_BUFFER token, 140โ€“141

GL_ATTACHED_SHADERS, 77

glAttachShader function, 75

glBeginQuery command, 184

glBeginTransformFeedback command, 213

glBindAttribLocation command, 139

glBindBuffer command, 142โ€“143, 212

glBindBufferBase function, 91, 212

glBindBufferRange function, 91, 212

glBindFramebuffer, 335โ€“336

glBindRenderbuffer function, 330โ€“331

glBindSamplers function, 274โ€“275

glBindTextures function, 231

glBindVertexArray function, 151

GL_BLEND token, 304

glBlendColor function, 313

glBlendEquation function, 313โ€“314

glBlendEquationSeparate function, 313โ€“314

glBlendFunc function, 312โ€“313

glBlendFuncSeparate function, 312โ€“313

glBlitFramebuffer command, 343โ€“344

glBufferData command, 144

GL_BUFFER_SIZE, 143

glBufferSubData command, 145

GL_BUFFER_USAGE, 143

glCheckFramebufferStatus command, 342

GL_CLAMP_TO_EDGE mode, 243โ€“244

glClear function, 40

glClear* functions, 299โ€“300

glClientWaitSync function, 359โ€“360

glColorMask function, 302

glCompileShader function, 37, 71โ€“72

glCompresedTexImage* functions, 277โ€“278

glCompresedTexSubImage* functions, 277โ€“278

glCompressedTexImage2D function, 263โ€“264

glCompressedTexImage3D function, 263โ€“264

glCompressedTexSubImage2D function, 267

GL_COMPRESSED_TEXTURE_FORMATS, 265

glCopyBufferSubData function, 159โ€“160

glCopyTexImage2D function, 270โ€“272

glCopyTexSubImage2D function, 270โ€“272

glCopyTexSubImage3D function, 270โ€“272

glCreateProgram function, 74โ€“75

glCreateShader function, 36โ€“37, 70โ€“71

glCullFace command, 181

GL_CULL_FACE state, 181

GL_DECR operation, 306

GL_DECR_WRAP operation, 306โ€“307

glDeleteBuffers command, 150

glDeleteFramebuffers command, 346โ€“347

glDeleteProgram function, 75

glDeleteQueries command, 184

glDeleteRenderbuffers command, 346โ€“347

glDeleteSamplers function, 273โ€“274

glDeleteShader function, 70โ€“71

GL_DELETE_STATUS, 77

glDeleteSync function, 359

glDeleteTextures function, 230โ€“231

glDeleteVertexArrays command, 154

glDepthFunc function, 311

glDepthMask function, 302

gl_DepthRange uniform type, 190

glDepthRangef command, 179

gl_DepthRangeParameters uniform type, 190

GL_DEPTH_TEST token, 304, 311

glDetachShader function, 75

glDisable command, 23โ€“24

glDisable function, 437โ€“438

glDisableVertexAttribArray command, 132โ€“135

GL_DITHER token, 304

glDrawArrays function, 40โ€“41, 165โ€“168, 341

glDrawArraysInstanced command, 165โ€“168, 170โ€“172

glDrawBuffers function, 321โ€“322

glDrawElements function, 165โ€“168, 172โ€“174, 341

glDrawElementsInstanced command, 165โ€“168, 170โ€“172, 172โ€“174

GL_DYNAMIC_COPY, 143

GL_DYNAMIC_DRAW, 143

GL_DYNAMIC_READ, 143

GL_ELEMENT_ARRAY_BUFFER token, 140โ€“141

glEnable function, 23โ€“24, 437โ€“438

glEnableVertexAttribArray command, 132โ€“135

glEndQuery command, 184

glEndTransformFeedback command, 213

glFenceSync function, 358

glFinish command, 358

glFlush command, 358

glFlushMappedBufferRange, 158โ€“159

gl_FragCoord variable, 283โ€“284

gl_FragDepth variable, 284

glFramebufferRenderbuffer command, 337โ€“338

glFramebufferTexture2D command, 338โ€“339

glFramebufferTextureLayer command, 339โ€“341

glFrontFace command, 180

gl_FrontFacing variable, 190, 284

glFrustrum function, see esFrustrum function

glGenBuffers command, 142โ€“143

glGenerateMipmap function, 242

glGenFramebuffers function, 330

glGenQueries command, 184

glGenRenderbuffers function, 329โ€“330

glGenSamplers function, 273

glGenTextures function, 230

glGenVertexArrays function, 151

glGetActiveAttrib command, 136โ€“137

glGetActiveAttrib function, 93

glGetActiveUniform function, 81โ€“82

glGetActiveUniform* functions, 81โ€“82

glGetActiveUniformBlockiv function, 89โ€“90

glGetActiveUniformBlockName function, 89โ€“90

glGetActiveUniformsiv function, 82, 87โ€“88

glGetAttachedShaders function, 438

glGetAttribLocation command, 140

glGetBooleanv function, 423

glGetBufferParameter* functions, 444

glGetBufferPointerv function, 444โ€“446

glGetError command, 22โ€“23

glGetFloatv function, 423

glGetFramebuffer AttachmentParameteriv function, 445โ€“446

glGetInteger* functions, 423

glGetInteger64v function, 92

glGetIntegerv command, 91, 214, 265

glGetProgramBinary function, 94

glGetProgramiv function

checking link status, 76

largest uniform name, getting, 81

number of active vertex attributes, querying, 137โ€“140

program compatibility, checking, 95

glGetQueryiv function, 442โ€“443

glGetQueryObjectuiv function, 185, 213, 443

glGetRenderbufferParameteriv function, 445โ€“446

glGetSamplerParameter* functions, 442

glGetShaderInfoLog function, 72โ€“73

glGetShaderiv function, 72

glGetShaderPrecisionFormat function, 439โ€“440

glGetShaderSource function, 439

glGetString* functions, 421โ€“422

glGetSynciv function, 443

glGetTexParameter* functions, 441โ€“442

glGetUniform* functions, 439

glGetUniformBlockIndex function, 89

glGetUniformLocation function, 83

glGetVertexAttrib* functions, 440โ€“441

GL_HALF_FLOAT data type

16-bit floating-point numbers, 458โ€“459

converting float to half-float, 459โ€“461

overview, 457โ€“458

glHint function, 435โ€“436

GL_INCR operation, 306

GL_INCR_WRAP operation, 306โ€“307

GL_INFO_LOG_LENGTH, 77

gl_InstanceID variable, 171โ€“172, 189

GL_INTERLEAVED_ATTRIBS, 77

glInvalidateFramebuffer command, 345โ€“346

glInvalidateSubFramebuffer command, 345โ€“346

GL_INVALID_ENUM code, 23

GL_INVALID_OPERATION code, 23

GL_INVALID_VALUE code, 23

GL_INVERT operation, 307

glIs* functions, 436

glIsEnabled function, 24, 437

GL_KEEP operation, 307

GL_LINE_LOOP, 163

GL_LINES, 163

GL_LINES mode, 213

GL_LINE_STRIP, 163

glLineWidth API call, 164

glLinkProgram command, 212

glLinkProgram function, 75โ€“76

GL_LINK_STATUS, 95

glMapBufferRange command, 155โ€“157

gl_MaxCombinedTextureImageUnits constant, 190

GL_MAX_COMBINED_UNIFORM_BLOCKS, 91

gl_MaxDrawBuffers constant, 285

gl_MaxFragmentInputVectors constant, 284

GL_MAX_FRAGMENT_UNIFORM_BLOCKS, 91

GL_MAX_FRAGMENT_UNIFORM_VECTORS, 109

gl_MaxFragmentUniformVectors constant, 285

gl_MaxFragmentUniformVectors variable, 109

gl_MaxProgramTexelOffset constant, 285

gl_MaxTextureImageUnits constant, 285

GL_MAX_UNIFORM_BLOCK_SIZE, 92

gl_MaxVertexAttribs constant, 190

gl_MaxVertexAttribs variable, 112

GL_MAX_VERTEX_ATTRIBS variable, 112

GL_MAX_VERTEX_OUTPUT_COMPONENTS variable, 113

gl_MaxVertexOutputVectors constant, 190

gl_MaxVertexOutputVectors variable, 113

gl_MaxVertexTextureImageUnits constant, 190

GL_MAX_VERTEX_TEXTURE_UNITS, 213

GL_MAX_VERTEX_UNIFORM_BLOCKS, 91

GL_MAX_VERTEX_UNIFORM_VECTORS, 109

gl_MaxVertexUniformVectors constant, 190, 193โ€“196

gl_MaxVertexUniformVectors variable, 109

gl_MinProgramTexelOffset constant, 285

GL_MIRRORED_REPEAT mode, 243โ€“244

GL_NO_ERROR code, 23

GL_OUT_OF_MEMORY code, 23

glPixelStorei function, 235

GL_PIXEL_UNPACK_BUFFER, 277โ€“278

gl_PointCoord variable, 164โ€“165, 284

GL_POINTS mode, 164โ€“165, 213

gl_PointSize variable, 164, 190

glPolygonOffset command, 182โ€“183

gl_Position variable, 190

glProgramBinary function, 94

GL_PROGRAM_BINARY_RETRIEVABLE_HINT, 77

GL_RASTERIZER_DISCARD, 214

glReadBuffer function, 269โ€“270

glReadPixels function, 316โ€“320, 346โ€“347

GL_REFLECTION_MAP mode, 206

glReleaseShaderCompiler function, 93

glRenderbufferStorage function, 331โ€“332

glRenderbufferStorageMultisample function, 331โ€“332

GL_REPEAT mode, 243โ€“244

GL_REPLACE operation, 306

GL_SAMPLE_ALPHA_TO_COVERAGE token, 304

glSampleCoverage function, 315โ€“316

GL_SAMPLE_COVERAGE token, 304

glScissor test, 304โ€“305

GL_SEPARATE_ATTRIBS, 77

glShaderSource function, 37, 71

GL_SPHERE_MAP mode, 206

GL_STATIC_COPY, 143

GL_STATIC_DRAW, 143

GL_STATIC_READ, 143

glStencilFunc function, 305โ€“311

glStencilFuncSeparate function, 305โ€“306

glStencilMask function, 302โ€“303

glStencilMaskSeparate function, 303

glStencilOp function, 306โ€“311

glStencilOpSeparate function, 306โ€“307

GL_STENCIL_TEST token, 304

GL_STREAM_COPY, 144

GL_STREAM_DRAW, 144

GL_STREAM_READ, 144

glTexImage* functions, 277โ€“278

glTexImage2D function, 231โ€“234

glTexImage3D function, 260โ€“262

glTexParameter* commands

API overhead, 273

setting minification/magnification filtering modes, 236, 239โ€“240

texture coordinate wrapping, 243

texture detail level, setting, 245

glTexStorage2D function, 276โ€“277

glTexStorage3D function, 276โ€“277

glTexSubImage* functions, 277โ€“278

glTexSubImage2D function, 266โ€“267

glTexSubImage3D function, 267โ€“269

GL_TEXTURE_BASE_LEVEL parameter, 245

GL_TEXTURE_COMPARE_FUNC parameter, 245โ€“246

GL_TEXTURE_COMPARE_MODE parameter, 245โ€“246

GL_TEXTURE_MAX_LOD parameter, 245

GL_TEXTURE_MIN_LOD parameter, 245

GL_TEXTURE_SWIZZLE_A parameter, 244โ€“245

GL_TEXTURE_SWIZZLE_B parameter, 244โ€“245

GL_TEXTURE_SWIZZLE_G parameter, 244โ€“245

GL_TEXTURE_SWIZZLE_R parameter, 244โ€“245

GL_TRANSFORM_FEEDBACK_VARYINGS, 77

GL_TRANSFORM_FEEDBACK_BUFFER_MODE, 77

GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN, 213

GL_TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH, 77

glTransformFeedbackVaryings command, 212

GL_TRIANGLE_FAN, 162โ€“163

GL_TRIANGLES, 162

GL_TRIANGLES mode, 213

GL_TRIANGLE_STRIP, 162

GL_UNIFORM_BLOCK_ACTIVE_ NUMBER_INDICES, 90

GL_UNIFORM_BLOCK_ACTIVE_UNIFORMS, 90

GL_UNIFORM_BLOCK_BINDING, 90

glUniformBlockBinding function, 90โ€“91

GL_UNIFORM_BLOCK_DATA_SIZE, 90

GL_UNIFORM_BLOCK_NAME_LENGTH, 90

GL_UNIFORM_BLOCK_REFERENCED_ BY_VERTEX_SHADER, 90

GL_UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER, 90

glUnmapBuffer command, 156โ€“157

gluPerspective function, see esPerspective function

glUseProgram function, 39, 78

glValidateProgram function, 78

GL_VALIDATE_STATUS, 77

glVertexAttrib* commands, 126

glVertexAttribDivisor command, 170โ€“172

glVertexAttribPointer function, 40, 131โ€“132

gl_VertexID variable, 189

glViewport command, 39, 178โ€“179

GLvoid data type, 21

glWaitSync function, 360

GL_ZERO operation, 306

greaterThan function, 475

greaterThanEqual function, 475

Guard band region, 177

H

Hello Triangle

back buffer, displaying, 41

code framework, 28

color buffer, clearing, 39โ€“40

double buffering, 41

drawing fragments, 35โ€“36

geometry, loading, 40โ€“41

OpenGL ES 3.0 framework, 34โ€“35

primitives, drawing, 40โ€“41

program objects, 38โ€“39

source code, 29โ€“33

transforming vertices, 35โ€“36

viewport, setting, 39โ€“40

windows, creating, 34โ€“35

Hello Triangle, shaders

compiling and loading, 36โ€“38

creating, 35โ€“36

fragment, creating, 35โ€“36

linking, 38โ€“39

vertex, creating, 35โ€“36

highp keyword, 120, 192โ€“193

Hints, 77, 435โ€“436

I

if-then-else tests. See Control flow statements.

Images

dimensions, specifying, 331

format, specifying, 331

Images, postprocessing

blur effect, 387โ€“390

light bloom, 389โ€“390

render-to-texture setup, 387

Immutable textures, 13, 276โ€“277

in qualifier, 106

Include files, EGL, 20

info logs, 77โ€“78

Initializing

arrays, 104

buffer objects, 145

EGL, 44, 46

scalar data types, 100

structures, 103

vector data types, 100

vertex array objects, 144

inout qualifier, 106

Input variables, fragment shader, 8

Instance ID, new features, 15

Instanced rendering, new features, 15

intBitsToFloat function, 470

Integer texture formats, 250โ€“252

Integer textures, new features, 12

Interpolation, 114โ€“115

Interpolation qualifiers

centroid sampling, 115

default behavior, 114

flat shading, 114

smooth shading, 114

Interpolators

definition, 113

packing, 117โ€“119

Invariance, 121โ€“123

invariant keyword, 121โ€“123

inverse function, 474

inversesqrt function, 467

iOS 7, 453โ€“455

isinf function, 470

isnan function, 470

J

JDK (Java SE Development Kit) 7, 451

K

Keywords

centroid, 115

highp, 120, 192โ€“193

invariant, 121โ€“123

lowp, 120, 192โ€“193

mediump, 120, 192โ€“193

L

Latitude-longitude maps, example, 205โ€“206

Layout qualifiers, 14, 109โ€“110

length function, 473

Lens flare effects, 183โ€“185

lessThan function, 475

lessThanEqual function, 475

Libraries, EGL, 20

Light bloom, 389โ€“390

Light projection matrix, 392โ€“393

Light view matrix, 392โ€“393

Lighting

equations, 369โ€“370

example, 199โ€“205

Lighting, per fragment

lighting equations, 369โ€“370

lighting shaders, 366โ€“369

with a normal map, 364โ€“365

overview, 363โ€“364

Lighting shaders, 366โ€“369

Lines

clipping, 177

description, 163โ€“164

width, specifying, 164

Linking shaders, example, 38โ€“39

Loading

2D texture arrays, 260โ€“262

3D textures, 260โ€“262

geometry, example, 40โ€“41

shaders, 36โ€“38, 73โ€“74

shaders, example, 36โ€“38

texture objects, 231โ€“234

textures, 230โ€“236

uniforms, 83โ€“85

LoadShader function, 36โ€“37

log function, 466

log2 function, 467

Loops. See Control flow statements.

lowp keyword, 120, 192โ€“193

M

Macros, defining, 115โ€“117

Magnification filtering mode, 236, 238โ€“241

main function, vertex shader, 6โ€“7

Mandatory online compiler, new features, 14

Mapping, texture formats to colors, 257

Mapping buffer objects

changing screen resolution, 157

data storage pointer, getting, 155โ€“156

flushing mapped buffers, 158โ€“159

overview, 154โ€“155

unmapping, 155โ€“156

Matrices

non-square, new features, 14

projective texturing, 392โ€“393

Matrix built-in functions, 474

Matrix components, 101โ€“102

Matrix construction, 101

Matrix data types, 99โ€“100

Matrix transformations, example, 196โ€“199

matrixCompMult function, 474

max function, 468

mediump keyword, 120, 192โ€“193

Meshes, connecting, 172

min function, 468

Min/max functions, new features, 17

Minification filtering mode, 236, 238โ€“241

Mipmap chains, 237โ€“238

Mipmapping

automatic generation, 242

detail levels, specifying, 245

mipmap chains, 237โ€“238

overview, 237โ€“241

mix function, 469

mod function, 468

Model matrix, example, 197โ€“198

Motion blur effects. See Rendering, to textures.

MRTs (multiple render targets)

deferred shading, 320โ€“321

in fragment shaders, 285

in fragments, 320โ€“324

new features, 17

overview, 320

setting up, 322โ€“324

specifying color attachments, 321โ€“322

Multi-sampled anti-aliasing, 314โ€“316

Multisample renderbuffers, 17, 333

Multitexturing, 286โ€“287

N

Naming conventions, 102

Nearest sampling, 237

New features, buffer objects

buffer object to buffer object copies, 16

buffer subrange mapping, 16

pixel buffer objects, 16

sampler objects, 16

sync objects, 16

uniform buffer objects, 16

vertex array objects, 16

New features, framebuffer

blend equations, 17

framebuffer invalidation hints, 17

min/max functions, 17

MRTs (multiple render targets), 17

multisample renderbuffers, 17

off-screen rendering, 17

New features, geometry

Boolean occlusion queries, 15

instanced rendering, 15

new vertex formats, 15

primitive restart, 15

transform feedback, 15

New features, shaders

built-in functions, 15

centroid sampling, 14

flat/smooth interpolators, 14

fragment depth, 15

full integer support, 14

instance ID, 15

layout qualifiers, 14

mandatory online compiler, 14

non-square matrices, 14

program binaries, 13โ€“14

relaxed restrictions, 15

uniform blocks, 14

vertex ID, 15

New features, texturing

2D texture arrays, 11

3D textures, 12

depth textures, 12

ETC/EAC texture compression, 12

floating-point textures, 12

gamma-correct rendering, 11

immutable textures, 13

increased minimum sizes, 13

integer textures, 12

NPOT (non-power-of-2) textures, 13

seamless cubemap filtering, 12, 241

shadow comparisons, 12

sRGB textures and framebuffers, 11

texture LOD (level of detail) features, 13

texture swizzles, 13

texturing, 11โ€“13

vendor-specific compressed texture formats, 12

New features, vendor-specific compressed texture formats, 12

New vertex formats, new features, 15

Noise, 3D texture

dust effects, 403โ€“404

example, 397

generating, 397โ€“402

water wave simulation, 404

wispy fog, 402โ€“404

noise3D function, 401

Non-square matrices, new features, 14

normalize function, 473

Normalized flag, 131โ€“132

Normalized texture formats, 247โ€“248

not function, 475

notEqual function, 475

NPOT (non-power-of-2) textures, new features, 13

O

Occlusion queries, 183โ€“185

Off-screen rendering, new features, 17

Offsetting polygons, 181โ€“183

OpenGL ES 1.0, specifications, 2

OpenGL ES 1.1

fixed-function vertex pipeline, 215โ€“223

specifications, 2

OpenGL ES 2.0, specifications, 2โ€“3

OpenGL ES 3.0

API specifications, 3โ€“4

command syntax, 21โ€“22

data types, 21โ€“22

emulating. See Emulating OpenGL ES 3.0.

error handling, 22โ€“23

implementations, querying, 421โ€“422

new features. See New features.

platforms. See Emulating OpenGL ES 3.0.

specifications, 2โ€“3

OpenGL ES 3.0, graphics pipeline. See also specific components.

diagram, 4

fragment shader, 8โ€“9

per-fragment operations, 9โ€“11

primitive assembly, 7

rasterization, 7

vertex shader, 4โ€“7

OpenGL ES 3.0 Emulator, 447โ€“449. See also Emulating OpenGL ES 3.0.

OpenGL ES Shading Language 3.0, specifications, 4

Operators, 104โ€“105

out qualifier, 106

outerProduct function, 474

Overlapping polygons, 181โ€“183

P

packed qualifier, 110

packHalf2x16 function, 472

Packing

interpolators, 117โ€“119

uniforms, 117โ€“119

packSnorm2x16 function, 471

Particle emissions, 381โ€“385

Particle systems

fragment shader, 377โ€“379

particle emissions, 381โ€“385

point sprites, 374

rendering algorithm, 381

rendering particles, 385โ€“386

setup, 374โ€“375

transform feedback, 380, 381โ€“385

vertex shader, 375โ€“377

Pbuffers (pixel buffers)

attributes, 57

creating, 56โ€“60

description, 56

errors, 58

PCF (percentage closest filtering), 245โ€“246, 414

Per fragment lighting

lighting equations, 369โ€“370

lighting shaders, 366โ€“369

with a normal map, 364โ€“365

overview, 363โ€“364

Per-fragment operations

blending, 10

depth test, 10

dithering, 10

overview, 9โ€“11

scissor test, 10

stencil test, 10

Performance

drawing primitives, 172โ€“174

FBOs (framebuffer objects), 354

hints, 435โ€“436

primitives, drawing, 172โ€“174

vertex attributes, storing, 131โ€“135

Perspective division, 178

Pixel buffer objects

new features, 16

pixel pack buffer objects, 320

pixel unpack buffer objects, 277โ€“278

Pixel buffers (pbuffers)

attributes, 57

creating, 56โ€“60

description, 56

errors, 59

Pixel pack buffer objects, 320

Pixel unpack buffer objects, 277โ€“278

Pixels

copying in framebuffer objects, 342โ€“344

in fragments, reading and writing, 316โ€“320

reading in framebuffer objects, 347

storage options, 236

texels (texture pixels), 226โ€“227

Point light, example, 202

Point sampling, 237

Point sprites

clipping, 177

description, 164โ€“165

position, 164

radius, 164

texture coordinates for, 284

Point sprites in particle systems, 374

Polygons

joins, smoothing (example), 207โ€“211

offsetting, 181โ€“183

overlapping, 181โ€“183

Position, point sprites, 164

Postprocessing effects. See Rendering, to textures.

pow function, 466

PowerVR Insider SDK v 3.2+, 448

PowerVR OpenGL ES 3.0 Emulator, 449โ€“450

Precision qualifiers

default precision, 120

variables, 119โ€“120

vertex shaders, 119โ€“120, 192โ€“193

Preprocessor directives. See also specific directives.

conditional tests, 115โ€“117

description, 115โ€“117

Primitive assembly

culling primitives, 7

overview, 174โ€“175

perspective division, 178

view frustrum, 7

viewport transformation, 178โ€“179

Primitive assembly, coordinate systems

clipping, 176โ€“177

guard band region, 177

overview, 175

Primitive restart, 15, 168โ€“169

Primitives. See also Geometry, new features.

definition, 7, 161

drawing, 7. See also Rasterization.

types of, 162โ€“165. See also specific primitives.

Primitives, drawing

example, 40โ€“41

geometry instancing, 169โ€“172

multiple disconnected primitives, 168โ€“169

multiple primitives, different attributes, 169โ€“172

overview, 165โ€“168

performance tips, 172โ€“174

primitive restart, 168โ€“169

provoking vertex, 168โ€“169

Procedural textures

anti-aliasing, 407โ€“410

checkerboard example, 405โ€“407

example, 405โ€“407

pros and cons, 404

Program binaries

compatibility check, 95

definition, 94

format, 95

getting, 94

new features, 13โ€“14

saving, 94

Program objects. See also Shader objects; Shaders.

attached shaders, counting, 77

attaching shaders, 75, 79

creating, 74โ€“79

definition, 69โ€“70

deleting, 75

deletion status, querying, 77

detaching shaders, 75

linking, 74โ€“79

making active, 78

validating, 78

Projection matrix, example, 198โ€“199

Projective texturing

basic techniques, 391โ€“392

bias matrix, 392โ€“393

definition, 391

light projection matrix, 392โ€“393

light view matrix, 392โ€“393

matrices, 392โ€“393

overview, 390โ€“391

spotlight shaders, 394โ€“397

Provoking vertex, 168โ€“169

Q

Qualcomm Adreno SDK v3.4+, 447

Qualifiers

column_major, 110

in, 106

inout, 106

out, 106

packed, 110

row_major, 110

shared, 110

std140, 110

Queries. See State queries.

R

radians function, 465

Radius, point sprites, 164

Rasterization

culling, 180โ€“181

enabling/disabling, 214

pipeline, 179

polygon offset, 181โ€“183

Recursion, in functions, 106

reflect function, 473

Reflective surfaces, 205โ€“206. See also Environment mapping; Projective texturing; Rendering, to textures.

refract function, 473

Renderbuffer objects. See also FBOs (framebuffer objects).

attached to framebuffer objects, 337โ€“338, 347

binding, 330โ€“331

creating, 329โ€“330

default values, 331

definition, 327

deleting, 346โ€“347

vs. FBOs (framebuffer objects), 328

formats, 333โ€“335

image dimensions, specifying, 331

image format, specifying, 331

multisample, 333

state values, 331

vs. textures, 328

Renderbuffers

multisample, new features, 17

querying, 445โ€“446

Rendering

from eye position with depth texture, 418โ€“420

gamma-correct, new features, 11

instanced, new features, 15

from light position into depth texture, 415โ€“418

off-screen area. See Pbuffers (pixel buffers).

on-screen area. See Windows.

particles, 381, 385โ€“386

rendered images, saving, 316โ€“320

shadows with depth texture, 414โ€“420

synchronizing, 66โ€“67

terrain with vertex texture fetch, 410โ€“414

Rendering, to off-screen surfaces. See also FBOs (framebuffer objects); Renderbuffer objects.

basic techniques, 326โ€“327

new features, 17

Rendering, to textures. See also FBOs (framebuffer objects).

basic techniques, 326โ€“327

examples, 348โ€“354

uses for, 326

while using the texture object in a fragment shader, 341

Rendering context, creating, 19, 60โ€“62, 325โ€“327. See also EGL; FBOs (framebuffer objects).

Rendering surfaces, creating with EGL, 19. See also EGL.

require behavior, 116

round function, 468

roundEven function, 468

row_major qualifier, 110

S

Sample coverage masks, 315

Sampler objects, 16, 273โ€“275

Samplers

definition, 256

fragment shader, 8

querying, 442

vertex shader, 4

Scalar data types

description, 99โ€“100

initializing, 100

type conversion, 100

Scissor test, 10, 304โ€“305

Screen resolution, effect on mapped buffer objects, 157

Seamless cubemap filtering, new features, 12, 241

Shader compiler, 93

Shader objects, 69โ€“70. See also Program objects; Shaders.

Shaders. See also Fragment shaders; Vertex shaders.

2D textures, 255โ€“257

attached to programs, querying, 438โ€“440

compiling, 70โ€“74

creating, 70โ€“74

deleting, 70

info log, retrieving, 72โ€“73

linking, 70

loading, 73โ€“74

source, providing, 71

texturing, 255โ€“257

version specification, declaring, 98

Shaders, new features

built-in functions, 15

centroid sampling, 14

flat/smooth interpolators, 14

fragment depth, 15

full integer support, 14

instance ID, 15

layout qualifiers, 14

mandatory online compiler, 14

non-square matrices, 14

program binaries, 13โ€“14

relaxed restrictions, 15

uniform blocks, 14

vertex ID, 15

Shading Language version, specifying in fragment shaders, 9

Shadow comparisons, new features, 12

Shadow mapping, 245โ€“246. See also Projective texturing; Rendering, to textures.

Shadows, rendering, 414โ€“420

Shared exponent texture formats, 252โ€“253

shared qualifier, 110

Shimmering. See Z fighting.

Shiny surfaces, example, 205โ€“206

sign function, 467

Signaling sync objects, 359โ€“360

sin function, 465

sinh function, 466

Smoke effects. See Particle systems.

Smooth shading, 114

smoothstep function, 470

Specifications, OpenGL ES

1.0, 2

1.1, 2

2.0, 2โ€“3

3.0, 2โ€“3

3.0 API, 3โ€“4

Shading Language 3.0, 4

Sphere maps, example, 205โ€“206

Spotlight, example, 202โ€“205

Spotlight shaders, 394โ€“397

sqrt function, 467

Square brackets ([ ]), array subscript operator, 101โ€“102

sRGB textures, 11, 254. See also Gamma-correct rendering.

Stairstep effects. See Anti-aliasing; Mipmapping.

State management

checking current state, 24

enabling/disabling state, 23โ€“24

overview, 23โ€“24

querying state values, 24

State queries

application-modifiable queries, 429โ€“435

asynchronous objects, 442โ€“443

entity names, 429โ€“435

framebuffer, 445โ€“446

implementation-dependent limits, 423โ€“428

nonprogrammable operations control, 436โ€“438

OpenGL ES 3.0 implementation string queries, 421โ€“422

renderbuffer, 445โ€“446

samplers, 442

shaders attached to programs, 438โ€“440

sync objects, 443

texture state, 441โ€“442

vertex attributes, 440โ€“441

vertex buffers, 444

std140 qualifier, 88โ€“89, 110

Stencil buffer test, 305โ€“311

Stencil buffers

buffer write masks, 303

fragment operations, 298โ€“299, 303. See also Fragments, buffers.

sharing, 329

Stencil test, per-fragment operations, 10

step function, 470

Structures, 103. See also Arrays of structures.

Structures of arrays, 128. See also Arrays.

Surface configurations

available, determining, 46โ€“47

choosing with EGL, 51โ€“53

Swapping, buffers, 298โ€“299

Swizzles. See Texture swizzles.

Sync objects

creating, 358โ€“359

deleting, 358โ€“359

example, 360โ€“361

fences, 358โ€“361

new features, 16

overview, 357โ€“358

querying, 443

signaling, 359โ€“360

waiting for, 359โ€“360

Synchronizing rendering, 66โ€“67

T

tan function, 465

tanh function, 466

Terrain surfaces, 214โ€“215, 410โ€“414

Test enable tokens, 304

Tests, fragments

depth buffer test, 311

overview, 303โ€“304

scissor test, 304โ€“305

stencil buffer test, 305โ€“311

test enable tokens, 304

Texels (texture pixels), 226โ€“227

texture built-in function, 257, 260, 478

Texture coordinates

generating, example, 205โ€“206

wrapping, 243โ€“244

Texture filtering

magnification, 236, 238โ€“241

minification, 236, 238โ€“241

nearest sampling, 237

overview, 237โ€“241

point sampling, 237

seamless cubemap filtering, 241

Texture filtering, mipmapping

automatic generation, 242

detail levels, specifying, 245

mipmap chains, 237โ€“238

overview, 237โ€“241

Texture formats

depth textures, 254โ€“255

floating-point, 249โ€“250

integer, 250โ€“252

mapping to colors, 257

normalized, 247โ€“248

overview, 246โ€“247

shared exponent, 252โ€“253

sRGB, 254

unsized, 247

Texture image units, in fragment shaders, 285

Texture LOD (level of detail) features, new features, 13

Texture lookup built-in functions, 476โ€“482

Texture maps, combining, 286โ€“287

Texture objects

overview, 230โ€“236

pixel storage options, 236

Texture pixels (texels), 226โ€“227

Texture state, querying, 441โ€“442

Texture swizzles

accessing vector components, 101

new features, 13

overview, 244โ€“245

Texture units, specifying min/max number, 190

textureGrad function, 481

textureGradOffset function, 481

textureLod function, 479

textureOffset function, 480

textureProj built-in function, 391, 479

textureProjGrad function, 482

textureProjGradOffset function, 482

textureProjLod function, 480

textureProjLodOffset function, 480

Textures

color components, mapping. See Texture swizzles.

combining texture maps, 286โ€“287

compressing, 262โ€“265

compression formats, 264โ€“265

copying from the color buffer, 269โ€“273

immutable, 276โ€“277

multitexturing, 286โ€“287

vs. renderbuffer objects, 328

subimage selection, 266โ€“269

textureSize function, 478

Texturing

depth texture compare, 245โ€“246

fetching from a texture map, 256

loading textures, 230โ€“236

PCF (percentage closest filtering), 245โ€“246

pixel unpack buffer objects, 277โ€“278

sampler objects, 273โ€“275

samplers, 256

in shaders, 255โ€“257

texels (texture pixels), 226โ€“227

volume textures. See 3D textures.

Texturing, 2D texture arrays

loading, 260โ€“262

overview, 230

Texturing, 2D textures

attached to framebuffer objects, 338โ€“339

base formats, 227

overview, 226โ€“227

in shaders, 255โ€“257

Texturing, 3D textures

attached to framebuffer objects, 339โ€“340

loading, 260โ€“262

overview, 229

Texturing, cubemap textures

environment mapping, 228โ€“229

overview, 228โ€“229

Texturing, new features

2D texture arrays, 11

3D textures, 12

depth textures, 12

ETC/EAC texture compression, 12

floating-point textures, 12

gamma-correct rendering, 11

immutable textures, 13

increased minimum sizes, 13

integer textures, 12

NPOT (non-power-of-2) textures, 13

seamless cubemap filtering, 12, 241

shadow comparisons, 12

sRGB textures and framebuffers, 11

texture LOD (level of detail) features, 13

texture swizzles, 13

texturing, 11โ€“13

vendor-specific compressed texture formats, 12

Texturing, texture objects

binding, 231

creating, 230

deleting, 230โ€“231

loading, 231โ€“234

minification/magnification filtering modes, setting, 236

overview, 230โ€“236

pixel storage options, 236

3D textures

attached to framebuffer objects, 339โ€“340

loading, 260โ€“262

new features, 12

overview, 229

3D textures, noise

dust effects, 403โ€“404

water wave simulation, 404

wispy fog, 402โ€“404

Transform feedback

example, 211โ€“214

new features, 15

in particle systems, 380โ€“385

vertex shader, 5

Transformation functions, 490โ€“494

Transforming vertices, example, 35โ€“36

Transparent fragments, 291โ€“293

transpose function, 474

Triangle fans, drawing, 162โ€“163

Triangle strips

connecting, 172โ€“174

drawing, 162โ€“163

generating degenerate triangles, 15

primitive restart, 15

winding order, 174

Triangles

clipping, 177

culling, 180โ€“181

degenerate, 15, 172

description, 162โ€“163

drawing, 162โ€“163

Trigonometry built-in functions, 465โ€“466

trunc function, 467

2D texture arrays

loading, 260โ€“262

new features, 11

overview, 230

2D textures

attached to framebuffer objects, 338โ€“339

base formats, 227

noise, 402

overview, 226โ€“227

in shaders, 255โ€“257

Type conversion, 100

U

Ubuntu Linux, emulating OpenGL ES 3.0, 449โ€“450

uintBitsToFloat function, 470

Uniform block indexes, associating with binding points, 90

Uniform blocks

active uniforms, counting, 90

description, 109โ€“111

examples, 109โ€“110

last buffer binding point, getting, 90

layout qualifiers, 109โ€“110

maximum for all shaders, querying, 91

maximum per shader, querying, 91

minimum supported number, 91

minimum total buffer object size, 90

name length, getting, 90

new features, 14

references to, querying, 90

Uniform buffer objects. See also Buffer objects.

available storage, querying, 92

binding, 91

new features, 16

overview, 87โ€“92

programming limitations, 91

Uniform names

largest, counting characters, 81

largest, getting, 77, 81

maximum length, querying, 77

Uniform variables. See Uniforms.

Uniforms

active, counting, 77

active, querying, 77, 86โ€“87

constant store, 109

description, 80, 108โ€“109

first category, 80

fragment shader, 8

getting, 81โ€“87

indexes, getting, 89

loading, 83โ€“85

maximum number in vertex shaders, 193โ€“196

maximum number of, determining, 109

named uniform blocks, 80, 88

packing, 117โ€“119

properties, getting, 81โ€“87

setting, 81โ€“87

sharing, 87โ€“92

std140 block layout, 88

vertex shader, 4

Unmapping mapped buffer objects, 155โ€“156

unpackHalf2x16 function, 472

unpackSnorm2x16 function, 471

unpackUnorm2x16 function, 471โ€“472

Unsized texture formats, 247

Updating, buffer objects, 145

User clip panes, 293โ€“295

V

Validating programs, description, 78

Validation status, querying, 77

Variable constructors, 100โ€“101

Variables, 119โ€“120. See also specific variables.

Varying variables. See Vertex shaders, output variables.

vec4 uniform entries, in fragment shaders, 285

Vector components

accessing, 101โ€“102

naming conventions, 102

Vector data types

description, 99โ€“100

initializing, 100

type conversion, 100

Vector relational built-in functions, 475

Vertex array objects

binding, 151

creating, 144, 151

deleting, 154

drawing with, 152โ€“154

initializing, 144

new features, 16

overview, 150โ€“151

Vertex attribute variables, declaring in vertex shaders, 135โ€“137

Vertex attributes

active, listing, 136โ€“137

enabling/disabling, 132โ€“135

minimum number required, 126

querying, 126, 440โ€“441

Vertex attributes, binding

to attribute variables, 137โ€“140

to locations, 139โ€“140

querying results of, 140

Vertex attributes, specifying

client vertex arrays, 126โ€“135

constant vertex attributes, 126

description, 126

Vertex attributes, storing. See also Arrays of structures; Structures of arrays.

constant vertex attributes, 132โ€“135

data conversions, 132

normalized flag, 131โ€“132

performance tips, 131โ€“135

selecting a data format, 131

vertex arrays, 132โ€“135

Vertex buffer objects. See also Buffer objects.

array buffer objects, 140โ€“141

binding, 141

creating, 141

element buffer objects, 140โ€“141

making current, 141

overview, 140โ€“141

state, 143โ€“144

types of, 140โ€“141

Vertex buffers, querying, 444

Vertex ID, new features, 15

Vertex shaders

2D texturing, 255โ€“257

displacement mapping, 214โ€“215

inputs/outputs, 111โ€“114, 188โ€“189. See also specific inputs/outputs.

interpolation, 114โ€“115

interpolators, 113

maximum uniform blocks, querying, 91

min/max limits, 190โ€“192, 193โ€“196

output variables, 5

precision qualifiers, 119โ€“120, 192โ€“193

Shading Language version, specifying, 6

uniforms, maximum number of, 193โ€“196

vertex normal, computing, 412โ€“413

vertex textures, 214โ€“215

water surfaces, 214โ€“215

Vertex shaders, built-ins

constants, 190โ€“192

special variables, 189โ€“190

uniform state, 190

Vertex shaders, examples

creating vertex shaders, 35โ€“36

cube maps, 205โ€“206

directional light, 199โ€“202

generating texture coordinates, 205โ€“206

height value, fetching, 412โ€“413

latitude-longitude maps, 205โ€“206

lighting, 199โ€“205

matrix transformations, 196โ€“199

model matrix, 197โ€“198

OpenGL ES 1.1 fixed-function vertex pipeline, 215โ€“223

point light, 202

polygon joins, smoothing, 207โ€“211

projection matrix, 198โ€“199

reflective surfaces, 205โ€“206

shiny surfaces, 205โ€“206

sphere maps, 205โ€“206

spotlight, 202โ€“205

terrain surfaces, 214โ€“215

transform feedback, 211โ€“214

vertex skinning, 207โ€“211

view matrix, 197โ€“198

Vertex shaders, overview

entry point, 6โ€“7

example, 6

inputs/outputs, 4โ€“5

main function, 6โ€“7

samplers, 4

shader program, 4

transform feedback, 5

uniforms, 4

vertex shader output variables, 5

Vertex skinning, example, 207โ€“211

Vertex textures, 214โ€“215

Vertices, transforming (example), 35โ€“36

View frustrum, 7

View matrix, example, 197โ€“198

Viewport, setting (example), 39โ€“40

Viewport transformation, 178โ€“179

Visual artifacts. See Mipmapping; Z-fighting artifacts.

W

Waiting for sync objects, 359โ€“360

warn behavior, 117

Water surfaces, vertex shaders, 214โ€“215

Water wave simulation, 404

Winding order, triangle strips, 174

Windowing systems, communicating with, 44โ€“45

Windows, 34โ€“35. See also EGL windows.

Windows, emulating OpenGL ES 3.0, 447โ€“449

Wrapping, texture coordinates, 243โ€“244

Z

Z-fighting artifacts

avoiding, 121โ€“123

polygon offset, 181โ€“183

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset