- ホーム
- > 洋書
- > 英文書
- > Computer / General
Full Description
OpenGL (R) Shading Language, Third Edition, extensively updated for OpenGL 3.1, is the experienced application programmer's guide to writing shaders. Part reference, part tutorial, this book thoroughly explains the shift from fixed-functionality graphics hardware to the new era of programmable graphics hardware and the additions to the OpenGL API that support this programmability. With OpenGL and shaders written in the OpenGL Shading Language, applications can perform better, achieving stunning graphics effects by using the capabilities of both the visual processing unit and the central processing unit.In this book, you will find a detailed introduction to the OpenGL Shading Language (GLSL) and the new OpenGL function calls that support it. The text begins by describing the syntax and semantics of this high-level programming language. Once this foundation has been established, the book explores the creation and manipulation of shaders using new OpenGL function calls.OpenGL (R) Shading Language, Third Edition, includes updated descriptions for the language and all the GLSL entry points added though OpenGL 3.1, as well as updated chapters that discuss transformations, lighting, shadows, and surface characteristics. The third edition also features shaders that have been updated to OpenGL Shading Language Version 1.40 and their underlying algorithms, includingTraditional OpenGL fixed functionality Stored textures and procedural textures Image-based lighting Lighting with spherical harmonics Ambient occlusion and shadow mapping Volume shadows using deferred lighting Ward's BRDF modelThe color plate section illustrates the power and sophistication of the OpenGL Shading Language. The API Function Reference at the end of the book is an excellent guide to theAPI entry points that support the OpenGL Shading Language.
Contents
Foreword to the Second Edition xxiForeword to the First Edition xxvPreface xxixAbout the Authors xxxvAbout the Contributors xxxviiAcknowledgments xxxixChapter 1: Review of OpenGL Basics 11.1 OpenGL History 11.2 OpenGL Evolution 41.3 Execution Model 51.4 The Framebuffer 61.5 State 91.6 Processing Pipeline 91.7 Drawing Geometry 111.8 Drawing Images 191.9 Coordinate Transforms 221.10 Texturing 271.11 Summary 331.12 Further Information 33Chapter 2: Basics 352.1 Introduction to the OpenGL Shading Language 352.2 Why Write Shaders? 372.3 OpenGL Programmable Processors 382.4 Language Overview 472.5 System Overview 542.6 Key Benefits 592.7 Summary 612.8 Further Information 63Chapter 3: Language Definition 653.1 Example Shader Pair 653.2 Data Types 673.3 Initializers and Constructors 763.4 Type Conversions 783.5 Qualifiers and Interface to a Shader 793.6 Flow Control 843.7 Operations 883.8 Preprocessor 933.9 Preprocessor Expressions 963.10 Error Handling 973.11 Summary 983.12 Further Information 98Chapter 4: The OpenGL Programmable Pipeline 1014.1 The Vertex Processor 1024.2 The Fragment Processor 1064.3 Built-in Uniform Variables 1104.4 Built-in Constants 1104.5 Interaction with OpenGL Fixed Functionality 1114.6 Summary 1154.7 Further Information 115Chapter 5: Built-in Functions 1175.1 Angle and Trigonometry Functions 1185.2 Exponential Functions 1215.3 Common Functions 1225.4 Geometric Functions 1345.5 Matrix Functions 1365.6 Vector Relational Functions 1385.7 Texture Access Functions 1405.8 Fragment Processing Functions 1765.9 Noise Functions 1775.10 Summary 1785.11 Further Information 178Chapter 6: Simple Shading Example 1816.1 Brick Shader Overview 1826.2 Vertex Shader 1836.3 Fragment Shader 1896.4 Observations 1966.5 Summary 1976.6 Further Information 197Chapter 7: OpenGL Shading Language API 1997.1 Obtaining Version Information 2007.2 Creating Shader Objects 2037.3 Compiling Shader Objects 2047.4 Linking and Using Shaders 2057.5 Cleaning Up 2107.6 Query Functions 2117.7 Specifying Vertex Attributes 2177.8 Specifying Uniform Variables 2267.9 Samplers 2387.10 Multiple Render Targets 2397.11 Development Aids 2407.12 Implementation-Dependent API Values 2417.13 Application Code for Brick Shaders 2427.14 Summary 2477.15 Further Information 248Chapter 8: Shader Development 2518.1 General Principles 2518.2 Performance Considerations 2548.3 Shader Debugging 2568.4 Shader Development Tools 2588.5 Scene Graphs 2638.6 Summary 2668.7 Further Information 266Chapter 9: Emulating OpenGL Fixed Functionality 2699.1 Transformation 2709.2 Light Sources 2739.3 Material Properties and Lighting 2779.4 Two-Sided Lighting 2799.5 No Lighting 2809.6 Fog 2819.7 Texture Coordinate Generation 2839.8 User Clipping 2869.9 Texture Application 2869.10 Matrices 2889.11 Operating on the Current Matrices 2919.12 Summary 2949.13 Further Information 294Chapter 10: Stored Texture Shaders 29710.1 Access to Texture Maps from a Shader 29810.2 Simple Texturing Example 30010.3 Multitexturing Example 30310.4 Cube Mapping Example 30910.5 Another Environment Mapping Example 31210.6 Glyph Bombing 31610.7 Summary 32610.8 Further Information 326Chapter 11: Procedural Texture Shaders 32911.1 Regular Patterns 33111.2 Toy Ball 33611.3 Lattice 34411.4 Bump Mapping 34511.5 Summary 35411.6 Further Information 354Chapter 12: Lighting 35712.1 Hemisphere Lighting 35712.2 Image-Based Lighting 36112.3 Lighting with Spherical Harmonics 36512.4 The UEberlight Shader 36912.5 Summary 37612.6 Further Information 376Chapter 13: Shadows 37913.1 Ambient Occlusion 38013.2 Shadow Maps 38513.3 Deferred Shading for Volume Shadows 39213.4 Summary 40013.5 Further Information 400Chapter 14: Surface Characteristics 40314.1 Refraction 40414.2 Diffraction 41014.3 BRDF Models 41514.4 Polynomial Texture Mapping with BRDF Data 42214.5 Summary 43114.6 Further Information 432Chapter 15: Noise 43515.1 Noise Defined 43615.2 Noise Textures 44415.3 Trade-offs 44715.4 A Simple Noise Shader 44815.5 Turbulence 45115.6 Granite 45315.7 Wood 45415.8 Summary 45715.9 Further Information 458Chapter 16: Animation 46116.1 On/Off 46216.2 Threshold 46316.3 Translation 46316.4 Morphing 46416.5 Other Blending Effects 46716.6 Vertex Noise 46816.7 Particle Systems 46916.8 Wobble 47616.9 Animating Once per Frame 48016.10 Summary 48316.11 Further Information 484Chapter 17: Antialiasing Procedural Textures 48717.1 Sources of Aliasing 48717.2 Avoiding Aliasing 48917.3 Increasing Resolution 49017.4 Antialiased Stripe Example 49117.5 Frequency Clamping 50217.6 Summary 50417.7 Further Information 504Chapter 18: Non-photorealistic Shaders 50718.1 Hatching Example 50818.2 Technical Illustration Example 51618.3 Mandelbrot Example 52118.4 Summary 52918.5 Further Information 530Chapter 19: Shaders for Imaging 53319.1 Geometric Image Transforms 53419.2 Mathematical Mappings 53419.3 Lookup Table Operations 53519.4 Color Space Conversions 53619.5 Image Interpolation and Extrapolation 53719.6 Blend Modes 54019.7 Convolution 54619.8 Summary 55519.9 Further Information 555Chapter 20: Language Comparison 55920.1 Chronology of Shading Languages 55920.2 RenderMan 56020.3 OpenGL Shader (ISL) 56320.4 HLSL 56520.5 Cg 56820.6 Summary 57020.7 Further Information 570Appendix A: Language Grammar 573Appendix B: API Function Reference 589Implementation-Dependent API Values for GLSL 590Other Queriable Values for GLSL 591glAttachShader 592glBindAttribLocation 594glCompileShader 597glCreateProgram 599glCreateShader 601glDeleteProgram 603glDeleteShader 605glDetachShader 607glDrawBuffers 609glEnableVertexAttribArray 612glGetActiveAttrib 614glGetActiveUniform 617glGetAttachedShaders 621glGetAttribLocation 623glGetProgram 625glGetProgramInfoLog 628glGetShader 630glGetShaderInfoLog 632glGetShaderSource 634glGetUniform 636glGetUniformLocation 638glGetVertexAttrib 640glGetVertexAttribPointer 643glIsProgram 645glIsShader 647glLinkProgram 648glShaderSource 652glUniform 654glUseProgram 661glValidateProgram 665glVertexAttrib 667glVertexAttribPointer 673OpenGL 1.5 to OpenGL 2.0 GLSL Migration Guide 676Afterword 681Glossary 685Further Reading 705Index 721