How it works...

The state stored within a GLSLProgram object includes the handle to the OpenGL shader program object (handle), a bool variable indicating whether or not the program has been successfully linked (linked), and map, which is used to store uniform locations as they are discovered (uniformLocations).

The compileShader overloads will throw GLSLProgramException if the compilation fails. The first version determines the type of shader based on the filename extension. In the second version, the caller provides the shader type, and the third version is used to compile a shader, taking the shader's source code from a string. The filename can be provided as a third argument if the string was taken from a file, which is helpful for providing ...

Get OpenGL 4 Shading Language Cookbook - Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.