What Are the Fundamental Scalar Types in GLSL?

The OpenGL Shading Language (GLSL) provides a core set of scalar data types designed specifically for programmable graphics pipelines. These fundamental types represent single-value numerical and logical quantities, serving as the essential building blocks for vectors, matrices, shader calculations, and vertex or fragment processing.

Core Scalar Data Types

GLSL defines five primary scalar data types:

Precision Qualifiers and Usage

In GLSL (especially OpenGL ES and WebGL), floating-point and integer types can be modified using precision qualifiers to optimize GPU register usage and performance:

Type Conversion and Strict Typing

GLSL enforces strict type checking and does not perform implicit type casting between different scalar types. Conversions must be handled explicitly through type constructors (for example, float(myInt) or int(myFloat)).