欢迎来到传世资源网!
加载中...
正在加载,请耐心等待...
本站为收藏、学习站,如有侵权,请联系管理员删除!

OpenGL ES 3.0 Programming Guide, 2nd Editi...

介绍 评论 失效链接反馈

【例子介绍】OpenGL ES 3.0 Programming Guide, 2nd Edition by Dan Ginsburg, Budirijanto Purnomo, Dave Shreiner, Aaftab Munshi (z-lib.org)

【相关图片】

OpenGL ES 3.0 Programming Guide, 2nd Edition by Dan Ginsburg, Budirijanto Purnomo, Dave Shreiner, Aaftab Munshi Ajax框架/RIA-第1张OpenGL ES 3.0 Programming Guide, 2nd Edition by Dan Ginsburg, Budirijanto Purnomo, Dave Shreiner, Aaftab Munshi Ajax框架/RIA-第2张OpenGL ES 3.0 Programming Guide, 2nd Edition by Dan Ginsburg, Budirijanto Purnomo, Dave Shreiner, Aaftab Munshi Ajax框架/RIA-第3张OpenGL ES 3.0 Programming Guide, 2nd Edition by Dan Ginsburg, Budirijanto Purnomo, Dave Shreiner, Aaftab Munshi Ajax框架/RIA-第4张OpenGL ES 3.0 Programming Guide, 2nd Edition by Dan Ginsburg, Budirijanto Purnomo, Dave Shreiner, Aaftab Munshi Ajax框架/RIA-第5张OpenGL ES 3.0 Programming Guide, 2nd Edition by Dan Ginsburg, Budirijanto Purnomo, Dave Shreiner, Aaftab Munshi Ajax框架/RIA-第6张OpenGL ES 3.0 Programming Guide, 2nd Edition by Dan Ginsburg, Budirijanto Purnomo, Dave Shreiner, Aaftab Munshi Ajax框架/RIA-第7张OpenGL ES 3.0 Programming Guide, 2nd Edition by Dan Ginsburg, Budirijanto Purnomo, Dave Shreiner, Aaftab Munshi Ajax框架/RIA-第8张OpenGL ES 3.0 Programming Guide, 2nd Edition by Dan Ginsburg, Budirijanto Purnomo, Dave Shreiner, Aaftab Munshi Ajax框架/RIA-第9张OpenGL ES 3.0 Programming Guide, 2nd Edition by Dan Ginsburg, Budirijanto Purnomo, Dave Shreiner, Aaftab Munshi Ajax框架/RIA-第10张OpenGL ES 3.0 Programming Guide, 2nd Edition by Dan Ginsburg, Budirijanto Purnomo, Dave Shreiner, Aaftab Munshi Ajax框架/RIA-第11张

【源码结构】

Contents
List of Figures ���������������������������������������������������������������������������������������xvii
List of Examples �������������������������������������������������������������������������������������xxi
List of Tables ������������������������������������������������������������������������������������������xxv
Foreword �����������������������������������������������������������������������������������������������xxix
Preface ��������������������������������������������������������������������������������������������������xxxi
Intended Audience . ??????????????????????xxxi
Organization of This Book . ??????????????????xxxii
Example Code and Shaders . ?????????????????xxxvi
Errata . ????????????????????????????xxxvi
Acknowledgments ����������������������������������������������������������������������������xxxvii
About the Authors ������������������������������������������������������������������������������xxxix
1� Introduction to OpenGL ES 3�0 � ��������������������������������������������������������������1
OpenGL ES 3.0 . ?????????????????????????3
Vertex Shader . ??????????????????????????4
Primitive Assembly . ???????????????????????7
Rasterization . ??????????????????????????7
Fragment Shader .?????????????????????????8
Per-Fragment Operations .?????????????????????9
What’s New in OpenGL ES 3.0 . ?????????????????11
Texturing .??????????????????????????11
Shaders .???????????????????????????13
www.it-ebooks.info
viii Contents
Geometry . ???????????????????????????15
Buffer Objects . ?????????????????????????16
Framebuffer . ??????????????????????????17
OpenGL ES 3.0 and Backward Compatibility .???????????17
EGL . ??????????????????????????????19
Programming with OpenGL ES 3.0 . ???????????????20
Libraries and Include Files .????????????????????20
EGL Command Syntax . ?????????????????????20
OpenGL ES Command Syntax . ?????????????????21
Error Handling . ?????????????????????????22
Basic State Management . ????????????????????23
Further Reading . ????????????????????????25
2� Hello Triangle: An OpenGL ES 3�0 Example ������������������������������������������27
Code Framework . ????????????????????????28
Where to Download the Examples .????????????????28
Hello Triangle Example . ?????????????????????29
Using the OpenGL ES 3.0 Framework . ??????????????34
Creating a Simple Vertex and Fragment Shader . ??????????35
Compiling and Loading the Shaders . ???????????????36
Creating a Program Object and Linking the Shaders . ???????38
Setting the Viewport and Clearing the Color Buffer .????????39
Loading the Geometry and Drawing a Primitive . ?????????40
Displaying the Back Buffer . ???????????????????41
Summary .????????????????????????????42
3� An Introduction to EGL ���������������������������������������������������������������������������43
Communicating with the Windowing System . ??????????44
Checking for Errors . ???????????????????????45
Initializing EGL .?????????????????????????46
Determining the Available Surface Configurations . ????????46
Querying EGLConfig Attributes . ?????????????????48
Letting EGL Choose the Configuration .??????????????51
Creating an On-Screen Rendering Area: The EGL Window . ????53
Creating an Off-Screen Rendering Area: EGL Pbuffers . ???????56
Creating a Rendering Context . ??????????????????60
www.it-ebooks.info
Contents ix
Making an EGLContext Current .?????????????????62
Putting All Our EGL Knowledge Together. ????????????63
Synchronizing Rendering . ????????????????????66
Summary .????????????????????????????67
4� Shaders and Programs ���������������������������������������������������������������������������69
Shaders and Programs .??????????????????????69
Creating and Compiling a Shader . ????????????????70
Creating and Linking a Program .?????????????????74
Uniforms and Attributes . ????????????????????80
Getting and Setting Uniforms . ??????????????????81
Uniform Buffer Objects . ?????????????????????87
Getting and Setting Attributes .??????????????????92
Shader Compiler . ????????????????????????93
Program Binaries . ????????????????????????94
Summary .????????????????????????????95
5� OpenGL ES Shading Language �������������������������������������������������������������97
OpenGL ES Shading Language Basics . ??????????????98
Shader Version Specification . ??????????????????98
Variables and Variable Types . ??????????????????99
Variable Constructors . ?????????????????????100
Vector and Matrix Components . ????????????????101
Constants .???????????????????????????102
Structures .???????????????????????????103
Arrays . ????????????????????????????104
Operators .???????????????????????????104
Functions .???????????????????????????106
Built-In Functions . ???????????????????????107
Control Flow Statements .????????????????????107
Uniforms . ???????????????????????????108
Uniform Blocks . ????????????????????????109
Vertex and Fragment Shader Inputs/Outputs . ??????????111
Interpolation Qualifiers . ????????????????????114
Preprocessor and Directives . ??????????????????115
Uniform and Interpolator Packing . ???????????????117
www.it-ebooks.info
x Contents
Precision Qualifiers . ??????????????????????119
Invariance . ??????????????????????????121
Summary . ???????????????????????????123
6� Vertex Attributes, Vertex Arrays, and Buffer Objects ��������������������������125
Specifying Vertex Attribute Data . ????????????????126
Constant Vertex Attribute . ???????????????????126
Vertex Arrays . ?????????????????????????126
Declaring Vertex Attribute Variables in a Vertex Shader . ?????135
Binding Vertex Attributes to Attribute Variables in a Vertex Shader
. ?????????????????????????????137
Vertex Buffer Objects . ?????????????????????140
Vertex Array Objects .??????????????????????150
Mapping Buffer Objects . ????????????????????154
Flushing a Mapped Buffer . ?????????????????158
Copying Buffer Objects . ????????????????????159
Summary . ???????????????????????????160
7� Primitive Assembly and Rasterization �������������������������������������������������161
Primitives .???????????????????????????161
Triangles . ???????????????????????????162
Lines . ?????????????????????????????163
Point Sprites .??????????????????????????164
Drawing Primitives . ??????????????????????165
Primitive Restart . ???????????????????????168
Provoking Vertex . ???????????????????????169
Geometry Instancing . ?????????????????????169
Performance Tips . ???????????????????????172
Primitive Assembly . ??????????????????????174
Coordinate Systems . ??????????????????????175
Perspective Division . ??????????????????????178
Viewport Transformation . ???????????????????178
Rasterization . ?????????????????????????179
Culling . ????????????????????????????180
Polygon Offset . ????????????????????????181
Occlusion Queries . ???????????????????????183
Summary . ???????????????????????????185
www.it-ebooks.info
Contents xi
8� Vertex Shaders ����������������������������������������������������������������������������187
Vertex Shader Overview . ????????????????????188
Vertex Shader Built-In Variables . ????????????????189
Precision Qualifiers . ??????????????????????192
Number of Uniforms Limitations in a Vertex Shader .???????193
Vertex Shader Examples . ????????????????????196
Matrix Transformations . ????????????????????196
Lighting in a Vertex Shader . ??????????????????199
Generating Texture Coordinates . ????????????????205
Vertex Skinning . ????????????????????????207
Transform Feedback . ??????????????????????211
Vertex Textures . ????????????????????????214
OpenGL ES 1.1 Vertex Pipeline as an ES 3.0 Vertex Shader . ????215
Summary . ???????????????????????????223
9� Texturing �������������������������������������������������������������������������������������225
Texturing Basics . ????????????????????????226
2D Textures . ??????????????????????????226
Cubemap Textures .???????????????????????228
3D Textures . ??????????????????????????229
2D Texture Arrays . ???????????????????????230
Texture Objects and Loading Textures . ?????????????230
Texture Filtering and Mipmapping . ???????????????237
Automatic Mipmap Generation . ????????????????242
Texture Coordinate Wrapping . ?????????????????243
Texture Swizzles . ????????????????????????244
Texture Level of Detail .?????????????????????245
Depth Texture Compare (Percentage Closest Filtering) .??????245
Texture Formats . ????????????????????????246
Using Textures in a Shader . ???????????????????255
Example of Using a Cubemap Texture . ?????????????258
Loading 3D Textures and 2D Texture Arrays . ??????????260
Compressed Textures . ?????????????????????262
Texture Subimage Specification .?????????????????266
Copying Texture Data from the Color Buffer . ??????????269
www.it-ebooks.info
xii Contents
Sampler Objects . ????????????????????????273
Immutable Textures . ??????????????????????276
Pixel Unpack Buffer Objects . ??????????????????277
Summary . ???????????????????????????278
10� Fragment Shaders �����������������������������������������������������������������������279
Fixed-Function Fragment Shaders . ???????????????280
Fragment Shader Overview . ??????????????????282
Built-In Special Variables .????????????????????283
Built-In Constants .???????????????????????284
Precision Qualifiers . ??????????????????????285
Implementing Fixed-Function Techniques Using Shaders . ????286
Multitexturing . ????????????????????????286
Fog . ??????????????????????????????288
Alpha Test (Using Discard) . ???????????????????291
User Clip Planes . ????????????????????????293
Summary . ???????????????????????????295
11� Fragment Operations �������������������������������������������������������������������297
Buffers . ????????????????????????????298
Requesting Additional Buffers . ?????????????????299
Clearing Buffers . ????????????????????????299
Using Masks to Control Writing to Framebuffers . ????????301
Fragment Tests and Operations .?????????????????303
Using the Scissor Test . ?????????????????????304
Stencil Buffer Testing . ?????????????????????305
Blending . ???????????????????????????311
Dithering . ???????????????????????????314
Multisampled Anti-Aliasing . ??????????????????314
Centroid Sampling . ????????????????????316
Reading and Writing Pixels to the Framebuffer . ?????????316
Pixel Pack Buffer Objects . ??????????????????320
Multiple Render Targets . ????????????????????320
Summary . ???????????????????????????324
www.it-ebooks.info
Contents xiii
12� Framebuffer Objects ��������������������������������������������������������������������325
Why Framebuffer Objects? .???????????????????325
Framebuffer and Renderbuffer Objects . ?????????????327
Choosing a Renderbuffer Versus a Texture as
a Framebuffer Attachment . ????????????????328
Framebuffer Objects Versus EGL Surfaces . ??????????329
Creating Framebuffer and Renderbuffer Objects .?????????329
Using Renderbuffer Objects . ??????????????????330
Multisample Renderbuffers . ??????????????????333
Renderbuffer Formats . ?????????????????????333
Using Framebuffer Objects .???????????????????335
Attaching a Renderbuffer as a Framebuffer Attachment . ???337
Attaching a 2D Texture as a Framebuffer Attachment . ????338
Attaching an Image of a 3D Texture as a Framebuffer
Attachment . ??????????????????????????339
Checking for Framebuffer Completeness . ????????????341
Framebuffer Blits . ???????????????????????342
Framebuffer Invalidation .????????????????????344
Deleting Framebuffer and Renderbuffer Objects. ?????????346
Deleting Renderbuffer Objects That Are Used
as Framebuffer Attachments . ???????????????347
Reading Pixels and Framebuffer Objects .???????????347
Examples . ???????????????????????????348
Performance Tips and Tricks . ??????????????????354
Summary . ???????????????????????????355
13� Sync Objects and Fences ������������������������������������������������������������357
Flush and Finish . ???????????????????????357
Why Use a Sync Object? . ????????????????????358
Creating and Deleting a Sync Object . ??????????????358
Waiting for and Signaling a Sync Object . ????????????359
Example . ???????????????????????????360
Summary . ???????????????????????????361
www.it-ebooks.info
xiv Contents
14� Advanced Programming with OpenGL ES 3�0 �������������������������������363
Per-Fragment Lighting . ?????????????????????363
Lighting with a Normal Map .??????????????????364
Lighting Shaders . ???????????????????????366
Lighting Equations . ??????????????????????369
Environment Mapping . ????????????????????370
Particle System with Point Sprites . ???????????????374
Particle System Setup . ?????????????????????374
Particle System Vertex Shader . ?????????????????375
Particle System Fragment Shader . ????????????????377
Particle System Using Transform Feedback . ???????????380
Particle System Rendering Algorithm .??????????????381
Particle Emission with Transform Feedback .???????????381
Rendering the Particles .?????????????????????385
Image Postprocessing . ?????????????????????387
Render-to-Texture Setup . ????????????????????387
Blur Fragment Shader . ?????????????????????388
Projective Texturing . ??????????????????????390
Projective Texturing Basics . ???????????????????391
Matrices for Projective Texturing . ????????????????392
Projective Spotlight Shaders . ??????????????????394
Noise Using a 3D Texture . ???????????????????397
Generating Noise . ???????????????????????397
Using Noise . ??????????????????????????402
Procedural Texturing . ?????????????????????404
A Procedural Texture Example . ?????????????????405
Anti-Aliasing of Procedural Textures . ??????????????407
Further Reading on Procedural Textures . ????????????410
Rendering Terrain with Vertex Texture Fetch . ??????????410
Generating a Square Terrain Grid .??????????????411
Computing Vertex Normal and Fetching Height Value
in Vertex Shader . ?????????????????????412
Further Reading on Large Terrain Rendering .?????????413
Shadows Using a Depth Texture . ????????????????414
Rendering from the Light Position Into a Depth Texture . ????415
Rendering from the Eye Position with the Depth Texture . ????418
Summary . ???????????????????????????420
www.it-ebooks.info
Contents xv
15� State Queries ������������������������������������������������������������������������������421
OpenGL ES 3.0 Implementation String Queries . ?????????421
Querying Implementation-Dependent Limits . ??????????423
Querying OpenGL ES State .???????????????????429
Hints . ?????????????????????????????435
Entity Name Queries .??????????????????????436
Nonprogrammable Operations Control and Queries . ??????436
Shader and Program State Queries . ???????????????438
Vertex Attribute Queries . ????????????????????440
Texture State Queries . ?????????????????????441
Sampler Queries . ????????????????????????442
Asynchronous Object Queries . ?????????????????442
Sync Object Queries . ??????????????????????443
Vertex Buffer Queries . ?????????????????????444
Renderbuffer and Framebuffer State Queries . ??????????445
Summary . ???????????????????????????446
16� OpenGL ES Platforms ���������������������������������������������������������������������������447
Building for Microsoft Windows with Visual Studio . ???????447
Building for Ubuntu Linux .???????????????????449
Building for Android 4.3 NDK (C ) .??????????????450
Prerequisites .??????????????????????????451
Building the Example Code with Android NDK . ?????????452
Building for Android 4.3 SDK (Java). ??????????????452
Building for iOS 7 . ???????????????????????453
Prerequisites .??????????????????????????453
Building the Example Code with Xcode 5 .????????????453
Summary . ???????????????????????????455
A� GL_HALF_FLOAT ������������������������������������������������������������������������457
16-Bit Floating-Point Number . ?????????????????458
Converting a Float to a Half-Float . ???????????????459
B� Built-In Functions ������������������������������������������������������������������������463
Angle and Trigonometry Functions . ??????????????465
Exponential Functions . ????????????????????466
Common Functions . ??????????????????????467
www.it-ebooks.info
xvi Contents
Floating-Point Pack and Unpack Functions . ???????????471
Geometric Functions . ?????????????????????472
Matrix Functions . ???????????????????????474
Vector Relational Functions . ??????????????????475
Texture Lookup Functions . ???????????????????476
Fragment Processing Functions .?????????????????483
C� ES Framework API ���������������������������������������������������������������������������������485
Framework Core Functions . ??????????????????485
Transformation Functions . ???????????????????490
Index �������������������������������������������������������������������������������������������495

下载声明:

本站资源均有第三方用户自行上传分享推荐,非本站自制,仅供玩家做交流学习之用!切勿用于商业用途!游戏作品版权归原作者享有,如有版权问题,请附带版权证明至邮件,本平台将应您的要求删除。
相关推荐:

评论

发表评论必须先登陆, 您可以 登陆 或者 注册新账号 !


在线咨询: 问题反馈
客服QQ:174666394

有问题请留言,看到后及时答复