售 价:¥
温馨提示:数字商品不支持退换货,不提供源文件,不支持导出打印
为你推荐
OpenGL 4 Shading Language Cookbook Second Edition
Table of Contents
OpenGL 4 Shading Language Cookbook Second Edition
Credits
About the Author
About the Reviewers
www.PacktPub.com
Support files, eBooks, discount offers and more
Why Subscribe?
Free Access for Packt account holders
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Downloading the example code
Downloading the color images of this book
Errata
Piracy
Questions
1. Getting Started with GLSL
Introduction
The OpenGL Shading Language
Profiles – Core vs. Compatibility
Using a function loader to access the latest OpenGL functionality
Getting ready
How to do it...
How it works...
There's more...
Generating a C++ loader
No-load styles
Using Extensions
See also
Using GLM for mathematics
Getting ready
How to do it...
How it works...
There's more...
Using the GLM types as input to OpenGL
See also
Determining the GLSL and OpenGL version
How to do it...
How it works...
There's more...
See also
Compiling a shader
Getting ready
How to do it...
How it works...
There's more...
Deleting a Shader Object
See also
Linking a shader program
Getting ready
How to do it...
How it works...
There's more...
Deleting a Shader program
See also
Sending data to a shader using vertex attributes and vertex buffer objects
Getting ready
How to do it...
How it works...
There's more...
Separate attribute format
Fragment shader output
Specifying attribute indexes without using layout qualifiers
Using element arrays
Interleaved arrays
Getting a list of active vertex input attributes and locations
Getting ready
How to do it...
How it works...
There's more...
See also
Sending data to a shader using uniform variables
Getting ready
How to do it...
How it works...
There's more...
See also
Getting a list of active uniform variables
Getting ready
How to do it…
How it works...
There's more...
See also
Using uniform blocks and uniform buffer objects
Getting ready
How to do it...
How it works...
There's more...
Using an instance name with a uniform block
Using layout qualifiers with uniform blocks
See also
Getting debug messages
Getting ready
How to do it...
How it works...
There's more...
Building a C++ shader program class
Getting ready
How to do it...
How it works...
See also
2. The Basics of GLSL Shaders
Introduction
Vertex and fragment shaders
Replicating the old fixed functionality
Implementing diffuse, per-vertex shading with a single point light source
Getting ready
How to do it...
How it works...
There's more...
See also
Implementing per-vertex ambient, diffuse, and specular (ADS) shading
Getting ready
How to do it...
How it works...
There's more...
Using a non-local viewer
Per-vertex versus per-fragment
Directional lights
Light attenuation with distance
See also
Using functions in shaders
Getting ready
How to do it...
How it works...
There's more...
The const qualifier
Function overloading
Passing arrays or structures to a function
See also
Implementing two-sided shading
Getting ready
How to do it...
How it works...
There's more...
Using two-sided rendering for debugging
See also
Implementing flat shading
How to do it...
How it works...
See also
Using subroutines to select shader functionality
Getting ready
How to do it...
How it works...
There's more...
See also
Discarding fragments to create a perforated look
Getting ready
How to do it...
How it works...
See also
3. Lighting, Shading, and Optimization
Introduction
Shading with multiple positional lights
Getting ready
How to do it...
How it works...
See also
Shading with a directional light source
Getting ready
How to do it...
How it works...
There's more...
See also
Using per-fragment shading for improved realism
Getting ready
How to do it...
How it works...
There's more...
See also
Using the halfway vector for improved performance
Getting ready
How to do it...
How it works...
There's more...
See also
Simulating a spotlight
Getting ready
How to do it...
How it works...
See also
Creating a cartoon shading effect
Getting ready
How to do it...
How it works...
There's more...
See also
Simulating fog
Getting ready
How to do it...
How it works...
There's more...
Computing distance from the eye
See also
Configuring the depth test
How to do it...
How it works...
See also
4. Using Textures
Introduction
Applying a 2D texture
Getting ready
How to do it...
How it works...
There's more...
Specifying the sampler binding within GLSL
See also
Applying multiple textures
Getting ready
How to do it...
How it works...
There's more...
See also
Using alpha maps to discard pixels
Getting ready
How to do it...
How it works...
There's more...
See also
Using normal maps
Getting ready
How to do it...
How it works...
See also
Simulating reflection with cube maps
Getting ready
How to do it...
How it works...
There's more...
See also
Simulating refraction with cube maps
Getting ready
How to do it...
How it works...
There's more...
The Fresnel equations
Chromatic aberration
Refracting through both sides of the object
See also
Applying a projected texture
Getting ready
How to do it...
How it works...
There's more...
See also
Rendering to a texture
Getting ready
How to do it...
How it works...
There's more...
See also
Using sampler objects
Getting ready
How to do it...
How it works...
See also
5. Image Processing and Screen Space Techniques
Introduction
Applying an edge detection filter
Getting ready
How to do it...
How it works...
There's more...
Optimization techniques
See also
Applying a Gaussian blur filter
Getting ready
How to do it...
How it works...
There's more...
See also
Implementing HDR lighting with tone mapping
Getting ready
How to do it...
How it works...
There's more...
See also
Creating a bloom effect
Getting ready
How to do it...
How it works...
There's more...
See also
Using gamma correction to improve image quality
How to do it...
How it works...
There's more...
Using multisample anti-aliasing
Getting ready
How to do it...
How it works...
There's more...
Using deferred shading
Getting ready
How to do it...
How it works...
There's more...
See also
Implementing order-independent transparency
Getting ready
How to do it...
How it works...
There's more...
See also
6. Using Geometry and Tessellation Shaders
Introduction
The shader pipeline extended
The geometry shader
The tessellation shaders
Point sprites with the geometry shader
Getting ready
How to do it...
How it works...
There's more...
Drawing a wireframe on top of a shaded mesh
Getting ready
How to do it...
How it works...
There's more...
See also…
Drawing silhouette lines using the geometry shader
Getting ready
How to do it...
How it works...
There's more...
See also
Tessellating a curve
Getting ready
How to do it...
How it works...
There's more...
Tessellating a 2D quad
Getting ready
How to do it...
How it works...
See also
Tessellating a 3D surface
Getting ready
How to do it...
How it works...
See also
Tessellating based on depth
Getting ready
How to do it...
How it works...
There's more...
See also
7. Shadows
Introduction
Rendering shadows with shadow maps
Getting ready
How to do it...
How it works...
There's more...
Aliasing
Rendering back faces only for the shadow map
See also
Anti-aliasing shadow edges with PCF
Getting ready
How to do it...
How it works...
There's more...
See also
Creating soft shadow edges with random sampling
Getting ready
How to do it...
How it works...
There's more...
See also
Creating shadows using shadow volumes and the geometry shader
Getting ready
How to do it...
How it works...
There's more...
See also
8. Using Noise in Shaders
Introduction
See Also…
Creating a noise texture using GLM
Getting ready
How to do it...
How it works...
There's more...
See also
Creating a seamless noise texture
Getting ready
How to do it...
How it works...
See also
Creating a cloud-like effect
Getting ready
How to do it...
How it works...
There's more...
See also
Creating a wood-grain effect
Getting ready
How to do it...
How it works...
There's more...
See also
Creating a disintegration effect
Getting ready
How to do it...
How it works...
See also
Creating a paint-spatter effect
Getting ready
How to do it...
How it works...
There's more...
See also
Creating a night-vision effect
Getting ready
How to do it...
How it works...
There's more...
See also
9. Particle Systems and Animation
Introduction
Animating a surface with vertex displacement
Getting ready
How to do it...
How it works...
There's more...
See also
Creating a particle fountain
Getting ready
How to do it...
How it works...
There's more...
See also
Creating a particle system using transform feedback
Getting ready
How to do it...
How it works...
There's more...
Using layout qualifiers
Querying transform feedback results
Recycling particles
See also
Creating a particle system using instanced particles
Getting ready
How to do it...
How it works...
There's more...
See also
Simulating fire with particles
Getting ready
How to do it...
How it works...
There's more...
See also
Simulating smoke with particles
Getting ready
How to do it...
How it works...
See also
10. Using Compute Shaders
Introduction
Compute space and work groups
Executing the Compute Shader
Implementing a particle simulation with the compute shader
Getting ready
How to do it...
How it works...
See also
Using the compute shader for cloth simulation
Getting ready
How to do it...
How it works...
There's more...
See also
Implementing an edge detection filter with the compute shader
Getting ready
How to do it...
How it works...
There's more...
See also
Creating a fractal texture using the compute shader
Getting ready
How to do it...
How it works...
There's more...
Index
买过这本书的人还买过
读了这本书的人还在读
同类图书排行榜