glScale

multiply the current matrix by a general scaling matrix

Signature

glScale( )->
glScale( x , y , z )
glScaled( GLdouble ( x ) , GLdouble ( y ) , GLdouble ( z ) )-> void
glScaled( x , y , z )
glScalef( GLfloat ( x ) , GLfloat ( y ) , GLfloat ( z ) )-> void
glScalef( x , y , z )

Parameters

VariablesDescription
x, y, z
Specify scale factors along the x , y , and z axes, respectively.

Description

glScale produces a nonuniform scaling along the x , y , and z axes. The three parameters indicate the desired scale factor along each of the three axes.
The current matrix (see glMatrixMode ) is multiplied by this scale matrix, and the product replaces the current matrix as if glMultMatrix were called with the following 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 , all objects drawn after glScale is called are scaled.
Use glPushMatrix and glPopMatrix to save and restore the unscaled coordinate system.

Notes

If scale factors other than 1 are applied to the modelview matrix and lighting is enabled, lighting often appears wrong. In that case, enable automatic normalization of normals by calling glEnable with the argument GL_NORMALIZE .

Errors

GL_INVALID_OPERATION is generated if glScale is executed between the execution of glBegin and the corresponding execution of glEnd .

Associated Gets

glGet with argument GL_MATRIX_MODE
glGet with argument GL_COLOR_MATRIX
glGet with argument GL_MODELVIEW_MATRIX
glGet with argument GL_PROJECTION_MATRIX
glGet with argument GL_TEXTURE_MATRIX

See Also

Sample Code References

The following code samples have been found which appear to reference the functions described here. Take care that the code may be old, broken or not even use PyOpenGL.

glScale
OpenGLContext tests/shader_3.py Lines: 161
OpenGLContext tests/shader_4_subset.py Lines: 62
{LGPL} PyMT pymt/core/svg/__init__.py Lines: 11, 173
Visvis wibjects/colorWibjects.py Lines: 529
Visvis core/cameras.py Lines: 702, 1171, 1789
Visvis core/base.py Lines: 812
{GPL3} OpenGL-Programmable 05-shader.py Lines: 130, 186, 221
{GPL3} OpenGL-Programmable 07-attrib.py Lines: 147, 205, 240
{GPL3} OpenGL-Programmable 03-array.py Lines: 63, 101, 136
{GPL3} OpenGL-Programmable 06-perpixel.py Lines: 138, 194, 229
{GPL3} OpenGL-Programmable 02-displaylist.py Lines: 63, 90, 134
{GPL3} OpenGL-Programmable 04-vbo.py Lines: 64, 120, 155
{GPL3} OpenGL-Programmable 01-direct.py Lines: 63, 85, 125
{GPL3} OpenGL-Programmable 08-pbo.py Lines: 158, 216, 262
glScaled
OpenGLContext OpenGLContext/scenegraph/transform.py Lines: 46
{LGPL} PyMT examples/games/untangle/graph.py Lines: 18
{LGPL} PyMT examples/games/tictactoe/tictactoe.py Lines: 102
glScalef
OpenGLContext tests/redbook_surface.py Lines: 72
OpenGLContext tests/redbook_trim.py Lines: 100
OpenGLContext tests/redbook_surface_cb.py Lines: 89
OpenGL-Demo PyOpenGL-Demo/NeHe/lesson26.py Lines: 166
OpenGL-Demo PyOpenGL-Demo/GLUT/glutplane.py Lines: 68
OpenGL-Demo PyOpenGL-Demo/redbook/cube.py Lines: 74
{Artistic License} PymmLib pymmlib/applications/glutviewer.py Lines: 236
{Artistic License} PymmLib pymmlib/mmLib/OpenGLDriver.py Lines: 444
{LGPL} VisionEgg VisionEgg/Core.py Lines: 838
{LGPL} VisionEgg test/conform.py Lines: 201, 219
{LGPL} PyMT examples/apps/3Ddrawing/3Ddrawing.py Lines: 138
{LGPL} PyMT examples/apps/3Dviewer/3Dviewer.py Lines: 91
{LGPL} PyMT examples/apps/pictures/pictures.py Lines: 32
{LGPL} PyMT pymt/ui/window/__init__.py Lines: 19, 457
{LGPL} PyMT pymt/ui/widgets/composed/vkeyboard.py Lines: 16, 516, 519
{LGPL} PyMT pymt/graphx/draw.py Lines: 228
{LGPL} PyMT pymt/lib/squirtle.py Lines: 16, 495, 497
{LGPL} Pyggel pyggel/image.py Lines: 99, 101, 166, 168
{LGPL} Pyggel pyggel/misc.py Lines: 220, 222, 331, 333
{LGPL} Pyggel pyggel/view.py Lines: 315
{LGPL} Pyggel pyggel/scene.py Lines: 194
{LGPL} Pyggel pyggel/geometry.py Lines: 145, 148, 151, 301, 303, 305, 451, 453, 579, 581, 583
{LGPL} Pyggel pyggel/font.py Lines: 317, 319, 524, 526, 958, 960, 1000, 1002
{LGPL} Pyggel pyggel/mesh.py Lines: 218, 220, 308, 310, 765, 767
{LGPL} pygl2d pygl2d/image.py Lines: 171
{GPL} Scocca scocca/graphics/opengl/transformations.py Lines: 22, 25, 28, 34

MathML Rendering

Powered by MathJax