Legacy (immediate mode)family

glTranslate*

Old calls that multiplied OpenGL's built-in current matrix by a translation (and glRotate, glScale by a rotation or scale).

Removed from the core profile. Built-in matrix stack, removed from the core profile in OpenGL 3.2.

Signature

void glTranslate{f|d}(T x, T y, T z);
void glRotate{f|d}(T angle, T x, T y, T z);
void glScale{f|d}(T x, T y, T z);

How it works

With glMatrixMode(GL_MODELVIEW) selected, each call multiplied the current matrix on the right, so the last call written applied first to the vertices. glRotatef took the angle in degrees. The modern equivalent builds the same matrices with GLM (glm::translate, glm::rotate in radians, glm::scale) and sends the result as a uniform.

Example

example.cpp
1// Legacy                        // Modern (GLM)
2glTranslatef(0, 0, -5);         // model = glm::translate(model, {0, 0, -5});
3glRotatef(45, 0, 1, 0);         // model = glm::rotate(model, glm::radians(45.f), {0, 1, 0});