Part of the Khronos Group

OpenGL Shading Language

This document describes a programming language that is a companion to OpenGL 2.0 and higher, called The OpenGL Shading Language. The OpenGL Shading Language is part of the core OpenGL 4.4 specification.

Download the OpenGL Shading Language Specification

The recent trend in graphics hardware has been to replace fixed functionality with programmability in areas that have grown exceedingly complex (e.g., vertex processing and fragment processing). The OpenGL Shading Language has been designed to allow application programmers to express the processing that occurs at those programmable points of the OpenGL pipeline. Independently compilable units that are written in this language are called shaders. A program is a set of shaders that are compiled and linked together.

The aim of this document is to thoroughly specify the programming language. The OpenGL entry points that are used to manipulate and communicate with programs and shaders are defined separately from this language specification.

The OpenGL Shading Language is based on ANSI C and many of the features have been retained except when they conflict with performance or ease of implementation. C has been extended with vector and matrix types (with hardware based qualifiers) to make it more concise for the typical operations carried out in 3D graphics. Some mechanisms from C++ have also been borrowed, such as overloading functions based on argument types, and ability to declare variables where they are first needed instead of at the beginning of blocks.


Column Header
Column Footer