Chapter 3. Language Definition
by John Kessenich
In this chapter, we present the language features of the OpenGL Shading Language. We start with a simple example of a working pair of vertex and fragment shaders to show their basic structure and interfaces. Each aspect of the language is then discussed in turn.
The OpenGL Shading Language syntax comes from the C family of programming languages. Tokens, identifiers, semicolons, nesting with curly braces, control-flow, and many keywords look like C. Both comment styles, // ... and /* ... */, are accepted. Much is also different, though, and all important differences from C are discussed.
Each shader example is presented as it might appear in a file or onscreen. However, as explained in Chapter ...
Get OpenGL® Shading Language, 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.