Portal:OpenGL Shading Language/Data Types

From OpenGL Wiki
Jump to navigation Jump to search

GLSL has a large number of Data Types. It has scalar boolean, floating point, double-precision float (for GLSL v4.00+), integer, and unsigned integer types. These can be aggregated into vectors and matrices up to 4 dimensions in size.

Vectors have a powerful swizzling mechanism that allows one to arbitrarily order their components. This works on both reading and writing, allowing for constructs like, output.zyx = input.xxy.

Variables can be aggregated into arrays and structs more or less arbitrarily (though having arrays that contain arrays requires GLSL v4.30).