没有合适的资源?快使用搜索试试~ 我知道了~
首页OpenGL超级宝典第四版:权威教程与参考指南
"OpenGL超级宝典第四版是一本全面的教程和参考书籍,由Richard S. Wright, Jr., Benjamin Lipchak和Nicholas Haemel合著。本书旨在帮助读者深入理解并掌握OpenGL编程技术。"
OpenGL是计算机图形学领域的一个强大标准,它允许开发者创建复杂的3D图形和视觉效果。OpenGL超级宝典第四版针对这个版本进行了全面更新,涵盖了现代OpenGL的核心概念和技术。在这一版中,作者们将深入讨论OpenGL的最新特性,包括:
1. **向量和矩阵操作**:OpenGL使用向量和矩阵进行几何变换,如平移、旋转和缩放。书中会详细介绍如何有效地使用这些数学工具。
2. **顶点着色器和片段着色器**:OpenGL 4.x引入了可编程管线,其中顶点着色器和片段着色器是关键部分。它们允许开发者自定义图形处理的各个阶段,实现高级渲染效果。
3. **纹理映射**:纹理是3D图形中的一个重要元素,用于给物体表面添加细节。书中会讲解如何加载、应用和管理纹理。
4. **帧缓冲对象(FBO)和离屏渲染**:OpenGL支持创建自定义的帧缓冲来实现复杂的后处理效果,如抗锯齿、深度缓冲和混合。
5. **程序化管线**:与旧版本的固定功能管线相比,现代OpenGL强调使用GLSL(OpenGL Shading Language)编写自定义着色器,从而提供更高的灵活性和性能。
6. **状态机和上下文管理**:理解OpenGL的状态机模型对于有效编程至关重要,书中会介绍如何正确管理上下文和状态。
7. **错误检测和调试**:学习如何使用OpenGL的错误处理机制以及第三方工具来调试代码,是提升开发效率的关键。
8. **性能优化**:本书还将涵盖如何利用现代GPU的并行计算能力,以及如何避免常见的性能瓶颈。
9. **跨平台编程**:OpenGL是一个跨平台的API,可以在Windows、Linux、macOS等操作系统上运行。书中有指导如何在不同平台上设置和使用OpenGL。
10. **案例研究和示例代码**:书中包含了大量的实例代码,帮助读者将理论知识应用于实际项目。
通过阅读OpenGL超级宝典第四版,读者不仅可以学习到OpenGL的基础知识,还能掌握高级特性,从而能够创建出高质量的3D应用程序,适用于游戏开发、科学可视化、虚拟现实等领域。这本书适合有一定编程基础,并希望深入学习3D图形编程的读者。
Color in the Real World..............................................................................186
Ambient Light....................................................................................187
Diffuse Light ......................................................................................188
Specular Light ....................................................................................188
Putting It All Together.......................................................................189
Materials in the Real World........................................................................190
Material Properties.............................................................................190
Adding Light to Materials..................................................................190
Calculating Ambient Light Effects ....................................................190
Diffuse and Specular Effects ..............................................................191
Adding Light to a Scene..............................................................................192
Enabling the Lighting........................................................................192
Setting Up Cosmic Background Radiation........................................192
Setting Material Properties ................................................................193
Using a Light Source ...................................................................................196
Which Way Is Up?.............................................................................197
Surface Normals.................................................................................197
Specifying a Normal ..........................................................................198
Unit Normals .....................................................................................201
Finding a Normal...............................................................................202
Setting Up a Source............................................................................203
Setting the Material Properties ..........................................................205
Specifying the Polygons ....................................................................205
Lighting Effects ...........................................................................................207
Specular Highlights............................................................................207
Specular Light ....................................................................................208
Specular Reflectance ..........................................................................208
Specular Exponent.............................................................................209
Normal Averaging..............................................................................211
Putting It All Together ................................................................................213
Creating a Spotlight...........................................................................214
Drawing a Spotlight...........................................................................216
Shadows.......................................................................................................221
What Is a Shadow? ............................................................................222
Squish Code .......................................................................................223
A Shadow Example ............................................................................223
Sphere World Revisited......................................................................227
Summary .....................................................................................................227
Contents xv
6 More on Colors and Materials....................................................................229
Blending ......................................................................................................229
Combining Colors .............................................................................230
Changing the Blending Equation .....................................................234
Antialiasing ........................................................................................234
Multisample .......................................................................................238
Applying Fog ...............................................................................................240
Fog Equations ....................................................................................242
Fog Coordinates.................................................................................244
Accumulation Buffer...................................................................................244
Other Color Operations..............................................................................248
Color Masking ...................................................................................248
Color Logical Operations...................................................................248
Alpha Testing .....................................................................................249
Dithering............................................................................................250
Summary .....................................................................................................250
7 Imaging with OpenGL ................................................................................251
Bitmaps........................................................................................................252
Bitmapped Data .................................................................................253
The Raster Position ............................................................................256
Pixel Packing ...............................................................................................257
Pixmaps .......................................................................................................258
Packed Pixel Formats .........................................................................260
A More Colorful Example..................................................................261
Moving Pixels Around .......................................................................265
Saving Pixels ......................................................................................266
More Fun with Pixels..................................................................................268
Pixel Zoom.........................................................................................275
Pixel Transfer .....................................................................................277
Pixel Mapping....................................................................................281
The Imaging “Subset” and Pipeline............................................................283
Color Matrix ......................................................................................288
Color Lookup.....................................................................................289
Proxies................................................................................................290
Other Operations...............................................................................291
Convolutions .....................................................................................292
Histogram ..........................................................................................297
Minmax Operations...........................................................................301
Summary .....................................................................................................301
OpenGL SuperBible, Fourth Editionxvi
8 Texture Mapping: The Basics .....................................................................303
Loading Textures.........................................................................................304
Using the Color Buffer ......................................................................307
Updating Textures..............................................................................307
Mapping Textures to Geometry ........................................................308
Texture Matrix ...................................................................................311
A Simple 2D Example .................................................................................311
Texture Environment..................................................................................316
Texture Parameters......................................................................................318
Basic Filtering.....................................................................................318
Texture Wrap .....................................................................................320
Cartoons with Texture.......................................................................321
Mipmapping ......................................................................................325
Texture Objects ...........................................................................................330
Managing Multiple Textures .............................................................331
Summary .....................................................................................................339
9 Texture Mapping: Beyond the Basics.........................................................341
Secondary Color..........................................................................................341
Anisotropic Filtering ...................................................................................344
Texture Compression ..................................................................................347
Compressing Textures........................................................................348
Loading Compressed Textures...........................................................349
Texture Coordinate Generation..................................................................350
Object Linear Mapping......................................................................354
Eye Linear Mapping...........................................................................355
Sphere Mapping.................................................................................356
Cube Mapping ...................................................................................357
Multitexture ................................................................................................362
Multiple Texture Coordinates ...........................................................363
A Multitextured Example ..................................................................364
Texture Combiners......................................................................................369
Point Sprites ................................................................................................371
Using Points.......................................................................................372
Texture Application ...........................................................................374
Point Parameters................................................................................374
Summary .....................................................................................................375
Contents xvii
10 Curves and Surfaces....................................................................................377
Built-in Surfaces ..........................................................................................378
Setting Quadric States........................................................................379
Drawing Quadrics ..............................................................................381
Modeling with Quadrics....................................................................385
Bézier Curves and Surfaces .........................................................................388
Parametric Representation.................................................................388
Evaluators...........................................................................................391
NURBS .........................................................................................................401
From Bézier to B-Splines....................................................................402
Knots ..................................................................................................402
Creating a NURBS Surface .................................................................403
NURBS Properties...............................................................................404
Defining the Surface ..........................................................................404
Trimming ...........................................................................................406
NURBS Curves....................................................................................409
Tessellation..................................................................................................409
The Tessellator ...................................................................................411
Tessellator Callbacks ..........................................................................412
Specifying Vertex Data ......................................................................413
Putting It All Together.......................................................................414
Summary .....................................................................................................419
11 It’s All About the Pipeline: Faster Geometry Throughput.........................421
Display Lists ................................................................................................422
Batch Processing ................................................................................423
Preprocessed Batches .........................................................................424
Display List Caveats...........................................................................426
Converting to Display Lists...............................................................426
Vertex Arrays ...............................................................................................428
Loading the Geometry ......................................................................432
Enabling Arrays..................................................................................432
Where’s the Data?..............................................................................433
Pull the Data and Draw .....................................................................434
Indexed Vertex Arrays .......................................................................435
Vertex Buffer Objects ..................................................................................450
Managing and Using Buffer Objects .................................................450
Back to the Thunderbird! ..................................................................452
Summary .....................................................................................................455
OpenGL SuperBible, Fourth Editionxviii
12 Interactive Graphics....................................................................................457
Selection ......................................................................................................458
Naming Your Primitives ....................................................................458
Working with Selection Mode...........................................................460
The Selection Buffer...........................................................................461
Picking ...............................................................................................464
Hierarchical Picking...........................................................................466
Feedback.............................................................................................471
The Feedback Buffer ..........................................................................471
Feedback Data....................................................................................472
Passthrough Markers .........................................................................473
A Feedback Example ...................................................................................473
Label the Objects for Feedback..........................................................473
Step 1: Select the Object....................................................................476
Step 2: Get Feedback on the Object ..................................................478
Summary .....................................................................................................480
13 Occlusion Queries: Why Do More Work Than You Need To? ...................481
The World Before Occlusion Queries .........................................................482
Bounding Boxes ..........................................................................................485
Querying the Query Object ........................................................................490
Best Practices ...............................................................................................492
Summary .....................................................................................................493
14 Depth Textures and Shadows.....................................................................495
Be That Light...............................................................................................496
Fit the Scene to the Window.............................................................496
No Bells or Whistles, Please...............................................................497
A New Kind of Texture ...............................................................................498
Size Matters........................................................................................499
Draw the Shadows First?!............................................................................500
And Then There Was Light.........................................................................501
Projecting Your Shadow Map: The “Why” .......................................501
Projecting Your Shadow Map: The “How”........................................503
The Shadow Comparison ..................................................................505
Two Out of Three Ain’t Bad........................................................................509
A Few Words About Polygon Offset ...........................................................510
Summary .....................................................................................................511
Contents xix
剩余1261页未读,继续阅读
169 浏览量
2011-07-30 上传
2011-07-30 上传
158 浏览量
2010-05-27 上传
Neverlandcc
- 粉丝: 0
- 资源: 4
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功