Basics of shaders
Shaders are small programs executed on a Graphics Processing Unit (GPU), which is located on the video card. Shaders work when OpenGL renders something on the screen (or in the screen buffer), and they modify the geometry and pixels of the rendered objects. They work very fast and perform advanced processing of images and complex 3D scenes at faster rates, which is impossible using today's CPUs. This is the reason that shaders are widely used for interactive rendering and VJing.
Shaders are written using Graphics Library Shading Language (GLSL), which is actually a C++ language, and are extended with vector and matrix types and mathematical operations. Some of the C++ features, such as working with memory (pointers, references, and the new
operator) and classes, are not included in GLSL.
Note
Formally, GLSL is a subset of the C language with some extensions, including constructor-like functions for initializing vectors and other types. As a result, the GLSL style of programming...