Book Image

OpenGL 4 Shading Language Cookbook - Second Edition

By : David Wolff
Book Image

OpenGL 4 Shading Language Cookbook - Second Edition

By: David Wolff

Overview of this book

OpenGL Shading Language (GLSL) is a programming language used for customizing parts of the OpenGL graphics pipeline that were formerly fixed-function, and are executed directly on the GPU. It provides programmers with unprecedented flexibility for implementing effects and optimizations utilizing the power of modern GPUs. With Version 4, the language has been further refined to provide programmers with greater power and flexibility, with new stages such as tessellation and compute. OpenGL 4 Shading Language Cookbook provides easy-to-follow examples that first walk you through the theory and background behind each technique, and then go on to provide and explain the GLSL and OpenGL code needed to implement it. Beginner level through to advanced techniques are presented including topics such as texturing, screen-space techniques, lighting, shading, tessellation shaders, geometry shaders, compute shaders, and shadows. OpenGL Shading Language 4 Cookbook is a practical guide that takes you from the fundamentals of programming with modern GLSL and OpenGL, through to advanced techniques. The recipes build upon each other and take you quickly from novice to advanced level code. You'll see essential lighting and shading techniques; examples that demonstrate how to make use of textures for a wide variety of effects and as part of other techniques; examples of screen-space techniques including HDR rendering, bloom, and blur; shadowing techniques; tessellation, geometry, and compute shaders; how to use noise effectively; and animation with particle systems. OpenGL Shading Language 4 Cookbook provides examples of modern shading techniques that can be used as a starting point for programmers to expand upon to produce modern, interactive, 3D computer graphics applications.
Table of Contents (17 chapters)
OpenGL 4 Shading Language Cookbook Second Edition
About the Author
About the Reviewers

About the Reviewers

Bartłomiej Filipek is an experienced software developer with a passion for teaching. He has been leading OpenGL and graphics programming courses at Jagiellonian University in Cracow for around five years now. Additionally he gives lectures and workshops about modern C++ techniques at local universities.

His professional experience focuses mostly on native application development including rendering systems, large-scale software development, game engines, multimedia applications, user interfaces, GPU computing, and even biofeedback.

He shares his programming stories at his blog:

Thomas Le Guerroué-Drévillon is a freshly graduated software engineer. Having a profound interest in mathematics and drawing, it came easily to him to mix together these two passions in one field: computer graphics.

Originally French, he used up all the opportunities given by his university to study and work all around the world. It allowed him to enjoy his first international experience in Estonia, the second in the prestigious KAIST in South Korea, and finally ending up now in Canada.

Even though his university provided the mathematical background, he got his experience with OpenGL and GLSL on his own. He believes that the link between the well documented API and the shader samples is missing. Thus he naturally accepted to review this cookbook, which for him is the material he would have loved to get a hand on when he started developing interests in OpenGL/GLSL.

Dr. Muhammad Mobeen Movania received his PhD degree in Advance Computer Graphics and Visualization from Nanyang Technological University, Singapore. After finishing his PhD, he joined Institute for Infocomm Research, A-Star, Singapore to work on Augmented Reality based Virtual Tryon and Cloth Simulation systems using GPU and OpenGL. Before joining NTU, he was a junior graphics programmer at Data Communication and Control (DCC) Pvt. Ltd., Karachi, Pakistan. He worked on DirectX and OpenGL API for producing real-time interactive tactical simulators and dynamic integrated training simulators. His research interests include GPU-based volumetric rendering techniques, GPU technologies, real-time soft body physics, real-time dynamic shadows, real-time collision detection and response, and hierarchical geometric data structures. He is also the author of the OpenCloth project (, which implements various cloth simulation algorithms in OpenGL. His blog ( lists a lot of useful graphics tips and tricks. When not involved with computer graphics, he composes music and is an avid squash player.

Dr. Mobeen has published several conference and journal papers on real-time computer graphics and visualization. Recently, he authored a book on OpenGL (OpenGL Development Cookbook by Packt Publishing, published in 2013) which details several applied recipes using modern OpenGL. He has also authored a book chapter in another book (OpenGL Insights by AK Peters/CRC Press, published in 2012).

Dr. Mobeen is currently an Assistant Professor at DHA Suffa University, Karachi, Pakistan where he is busy nurturing young minds to become outstanding programmers and researchers of tomorrow.

Dario Scarpa has been coding for fun and profit for the last 15 years, and has no intention to stop. Jumping around among IT jobs as developer/sysadmin, amateur video game programming, and CS exams at the University of Salerno (Italy), he also managed to work with Adventure Productions in building Zodiac, a digital delivery platform focused on adventure games. At the time of reviewing this book, he's about to get his Master's degree, with a thesis on computer graphics that got him working intensively with—guess what—OpenGL.

Javed Rabbani Shah received his degree in Electrical Engineering from the University of Engineering and Technology, Lahore, Pakistan in 2004. He started his professional career by joining Delta Indus Systems (now Vision Master Inc.), where he worked with solder paste inspection systems for statistical process control involving technologies such as Image Processing, 3D Machine Vision, and FPGAs. He then joined the Embedded Systems Division of Mentor Graphics in 2007 and got the opportunity to work with the Nucleus+ real-time operating system, USB 2.0 middleware, WebKit, and OpenGL ES 2.0. He spearheaded the effort to integrate OpenGL ES 2.0 features in Mentor's cross-platform Inflexion 3D user interface engine.

He is currently working at Saffron Digital in central London, where he is involved in work related to cross-platform secure video playback, DRM, and UltraViolet technologies.

In his spare time, he likes to learn emerging technologies like OpenGL ES 3.0 and OpenCL.