GLSCALE(3G)
π
GLSCALE β bestie edition (it's a 3G manual page, iykyk)
okay so. you wanna scale stuff. non-uniformly. along all three axes at once. say less, queen β that's literally what glScaled and glScalef are for β¨
πΈ NAME πΈ
glScaled, glScalef β multiply the current matrix by a general scaling matrix. that's it, that's the whole job description π«Ά
π C SPECIFICATION π
here's the exact signature, don't @ me:
void glScaled( GLdouble x,
GLdouble y,
GLdouble z )
void glScalef( GLfloat x,
GLfloat y,
GLfloat z )
two flavors, same energy. one's double, one's float. pick your fighter π
π¦ PARAMETERS π¦
x,y,zβ the scale factors along the x, y, and z axes respectively. like, how much are we stretching each direction. that's the whole thing π
β¨ DESCRIPTION β¨
glScale produces a nonuniform scaling along the x, y, and z axes. nonuniform meaning it does not have to be the same in every direction β you can squish one axis and stretch another, main character behavior honestly. the three parameters tell you the desired scale factor along each of the three axes.
the current matrix (peep glMatrixMode) gets multiplied by this scale matrix, and the product replaces the current matrix, exactly as if glScale had been called with this matrix as its argument:
x 0 0 0
β0 y 0 0β
0 0 z 0
0 0 0 1
if the matrix mode is either GL_MODELVIEW or GL_PROJECTION, then all objects drawn after glScale is called are scaled. so like. everything downstream gets the vibe. no takebacks unless you do takebacks π
speaking of takebacks β use glPushMatrix and glPopMatrix to save and restore the unscaled coordinate system. save state, do your scaling, pop it back. iconic combo, they're besties fr fr π«Ά
π NOTES π
if scale factors other than 1 are applied to the modelview matrix and lighting is enabled, lighting often appears wrong. yeah. it's giving cursed. π
in that case, enable automatic normalization of normals by calling glEnable with the argument GL_NORMALIZE. that's the fix, bestie, write it down π
π₯ ERRORS π₯
GL_INVALID_OPERATIONis generated ifglScaleis executed between the execution ofglBeginand the corresponding execution ofglEnd.
translation: do not call this inside a glBegin/glEnd block. the GL gods will simply Not Allow It π
β ASSOCIATED GETS β
all the glGet calls that vibe with this one:
glGetwith argumentGL_MATRIX_MODEglGetwith argumentGL_COLOR_MATRIXglGetwith argumentGL_MODELVIEW_MATRIXglGetwith argumentGL_PROJECTION_MATRIXglGetwith argumentGL_TEXTURE_MATRIX
π SEE ALSO π
go read these next, they're all in the same friend group:
glMatrixMode(3G)glMultMatrix(3G)glPushMatrix(3G)glRotate(3G)glTranslate(3G)
okay that's the whole page, you ate it, you understood it, you're gonna go scale something beautiful now π and yes this was the GLSCALE(3G) manual page, signing off, mwah πβ¨
π¦ where this page comes from
- centos-stream 9: gl-manpages 1.1-24.20190306.el9 Β· MIT and Open Publication
- fedora 43: gl-manpages 1.1-34.20190306.fc43 Β· Apache-2.0 AND HPND AND HPND-sell-variant AND MIT AND OpenPBS-2.3 AND SGI-B-2.0 AND W3C-19980720 AND X11
- fedora 44: gl-manpages 1.1-35.20190306.fc44 Β· Apache-2.0 AND HPND AND HPND-sell-variant AND MIT AND OpenPBS-2.3 AND SGI-B-2.0 AND W3C-19980720 AND X11
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms