This book is a practical guide to the OpenGL Shading Language, which contains several real-world examples that will allow you to grasp the core concepts easily and the use of the GLSL for graphics rendering applications.If you want upgrade your skills, or are new to shader programming and want to learn about graphic programming, this book is for you. If you want a clearer idea of shader programming, or simply want to upgrade from fixed pipeline systems to state-of-the-art shader programming and are familiar with any C-based language, then this book will show you what you need to know.
Cover; Copyright; Credits; About the Author; About the Reviewers; www.PacktPub.com; Table of Contents; Preface; Chapter 1: The Graphics Rendering Pipeline; A brief history of graphics hardware; The Graphics Rendering Pipeline; Geometry stages (per-vertex operations); Fragment stages (per-fragment operations); External stages; Differences between fixed and programmable designs; Types of shaders; Vertex shaders; Fragment shaders; Geometry shaders; Compute shaders; GPU, a vectorial and parallel architecture; The shader environment; Summary; Chapter 2: GLSL Basics; The Language; Language basics
InstructionsBasic types; Variable initializers; Vector and matrix operations; Castings and conversions; Code comments; Flow control; Loops; Structures; Arrays; Functions; Preprocessor; Shader input/output variables; Uniform variables; Other input variables; Shader output variables; Summary; Chapter 3 : Vertex Shaders; Vertex shader inputs; Vertex attributes; Uniform variables; Vertex shader outputs; Drawing a simple geometry sample; Distorting a geometry sample; Using interpolators; Simple lighting; Basic lighting theory; Lighting example code; Summary; Chapter 4: Fragment Shaders
Execution modelTerminating a fragment shader; Inputs and outputs; Examples; Solid color mesh; Interpolated colored mesh; Using interpolators to compute the texture coordinates; Phong lighting; Summary; Chapter 5: Geometry Shaders; Geometry shaders versus vertex shaders; Inputs and outputs; Interface blocks; Example - pass-thru shader; Example - using attributes in the interface blocks; Crowd of butterflies; Summary; Chapter 6: Compute Shaders; Execution model; Render to texture example; Raw data computations; Summary; Index