Chapter 2. GLSL Basics
OpenGL Shading Language is based on ANSI C. Many features of the C programming language have been incorporated to GLSL, while the ones that go against performance or language simplicity have been removed.
All GLSL shader types (vertex, fragment, geometry, and compute) use the same language, so you will benefit a lot from this chapter. All you will learn in this chapter will serve for every following chapter. In this chapter you will learn the basics of the language and the common elements between each shader type. Specifically, we will talk about the following topics:
Language basics
Shader input/ouput variables
Because GLSL is very close to the C language, I won't expose a complete and exhaustive list of each language element. I'll focus only on the differences between GLSL and C, and the biggest difference of them all, which will definitely lighten up a lot of readers, is that GLSL does not have pointers.