# glRotate

multiply the current matrix by a rotation matrix

## Signature

glRotate( )->
glRotate( x , y , )
glRotated( GLdouble ( angle ) , GLdouble ( x ) , GLdouble ( y ) , GLdouble ( z ) )-> void
glRotated( x , y , )
glRotatef( GLfloat ( angle ) , GLfloat ( x ) , GLfloat ( y ) , GLfloat ( z ) )-> void
glRotatef( x , y , )

## Parameters

VariablesDescription
angle
Specifies the angle of rotation, in degrees.
x, y, z
Specify the x , y , and z coordinates of a vector, respectively.

## Description

glRotate produces a rotation of angle degrees around the vector $\left(\mathit{x},\mathit{y},\mathit{z}\right)$ . The current matrix (see glMatrixMode ) is multiplied by a rotation matrix with the product replacing the current matrix, as if glMultMatrix were called with the following matrix as its argument:
$\left(\begin{array}{cccc}{\mathit{x}}^{2}\left(1-\mathit{c}\right)+\mathit{c}& \mathit{x}\mathit{y}\left(1-\mathit{c}\right)-\mathit{z}\mathit{s}& \mathit{x}\mathit{z}\left(1-\mathit{c}\right)+\mathit{y}\mathit{s}& 0\\ \mathit{y}\mathit{x}\left(1-\mathit{c}\right)+\mathit{z}\mathit{s}& {\mathit{y}}^{2}\left(1-\mathit{c}\right)+\mathit{c}& \mathit{y}\mathit{z}\left(1-\mathit{c}\right)-\mathit{x}\mathit{s}& 0\\ \mathit{x}\mathit{z}\left(1-\mathit{c}\right)-\mathit{y}\mathit{s}& \mathit{y}\mathit{z}\left(1-\mathit{c}\right)+\mathit{x}\mathit{s}& {\mathit{z}}^{2}\left(1-\mathit{c}\right)+\mathit{c}& 0\\ 0& 0& 0& 1\end{array}\right)$
Where $\mathit{c}=\mathit{cos}\left(\mathit{angle}\right)$ , $\mathit{s}=\mathit{sin}\left(\mathit{angle}\right)$ , and $\left(\mathit{x},\mathit{y},\mathit{z}\right)=1$ (if not, the GL will normalize this vector).
If the matrix mode is either GL_MODELVIEW or GL_PROJECTION , all objects drawn after glRotate is called are rotated. Use glPushMatrix and glPopMatrix to save and restore the unrotated coordinate system.

## Notes

This rotation follows the right-hand rule, so if the vector $\left(\mathit{x},\mathit{y},\mathit{z}\right)$ points toward the user, the rotation will be counterclockwise.

## Errors

GL_INVALID_OPERATION is generated if glRotate 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

## 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.

glRotate
OpenGLContext tests/shaders.py Lines: 24, 25
OpenGLContext tests/solid_font.py Lines: 72
OpenGLContext tests/shader_3.py Lines: 160
OpenGLContext OpenGLContext/move/viewplatform.py Lines: 145
OpenGLContext OpenGLContext/passes/rendervisitor.py Lines: 221
OpenGL-Demo PyOpenGL-Demo/GLUT/tom/text.py Lines: 103
OpenGL-Demo PyOpenGL-Demo/GLUT/tom/arraytest.py Lines: 81
OpenGL-Demo PyOpenGL-Demo/GLUT/tom/lorentz.py Lines: 109
OpenGL-Demo PyOpenGL-Demo/GLUT/tom/cone.py Lines: 97
OpenGL-Demo PyOpenGL-Demo/GLUT/tom/checker.py Lines: 96
{LGPL} PyUI tests/testcube.py Lines: 48, 66, 67, 68
{LGPL} PyUI pyui/renderers/openglBase.py Lines: 227
{LGPL} PyUI2 renderers/openglBase.py Lines: 227
{LGPL} VisionEgg VisionEgg/Text.py Lines: 323
{LGPL} VisionEgg VisionEgg/Textures.py Lines: 1420
{LGPL} VisionEgg VisionEgg/MoreStimuli.py Lines: 114, 310
{LGPL} VisionEgg VisionEgg/Gratings.py Lines: 335
{LGPL or GPL or MPL} Kamaelia Sketches/CL/Topology3D/THF/Examples/simplecube/simplecube_controlled.py Lines: 105, 106
{LGPL or GPL or MPL} Kamaelia Sketches/CL/Topology3D/THF/Examples/simplecube/simplecube.py Lines: 45
{LGPL or GPL or MPL} Kamaelia Sketches/THF/simplecube/simplecube_controlled.py Lines: 105, 106
{LGPL or GPL or MPL} Kamaelia Sketches/THF/simplecube/simplecube.py Lines: 45
{LGPL or GPL or MPL} Kamaelia Sketches/MPS/Old/SoC/simplecube.py Lines: 81
Visvis core/cameras.py Lines: 1163, 1164, 1165, 1783
Visvis core/base.py Lines: 814
{GPL3} OpenGL-Programmable 07-attrib.py Lines: 146
{GPL3} OpenGL-Programmable 06-perpixel.py Lines: 137
{GPL3} OpenGL-Programmable 08-pbo.py Lines: 157
{GPL3} OpenGL-Programmable 01-direct.py Lines: 62
{GPL3} OpenGL-Programmable 02-displaylist.py Lines: 62
{GPL3} OpenGL-Programmable 04-vbo.py Lines: 63
{GPL3} OpenGL-Programmable 03-array.py Lines: 62
{GPL3} OpenGL-Programmable 05-shader.py Lines: 129
glRotated
OpenGLContext tests/glut_fullscreen.py Lines: 21
OpenGLContext tests/nehe4.py Lines: 51, 67
OpenGLContext tests/nehe6_timer.py Lines: 83, 84, 85
OpenGLContext tests/nehe6_multi.py Lines: 77, 78, 79
OpenGLContext tests/nehe8.py Lines: 85
OpenGLContext tests/nehe6.py Lines: 68
OpenGLContext tests/readpixelsleak.py Lines: 20
OpenGLContext tests/nehe6_convolve.py Lines: 138
OpenGLContext tests/nehe5.py Lines: 28, 33
OpenGLContext tests/saveimage.py Lines: 40
OpenGLContext tests/nehe7.py Lines: 146
OpenGLContext OpenGLContext/wxcontext.py Lines: 312, 313
OpenGLContext OpenGLContext/pygameinteractivecontext.py Lines: 33, 34
OpenGLContext OpenGLContext/pygamecontext.py Lines: 150, 151
OpenGLContext OpenGLContext/scenegraph/transform.py Lines: 34, 45, 53
OpenGL-Demo PyOpenGL-Demo/redbook/movelight.py Lines: 97
{LGPL} PyMT examples/apps/pictures/pictures.py Lines: 31
{LGPL} PyMT examples/games/untangle/data_viewer.py Lines: 64, 66
glRotatef
OpenGLContext tests/redbook_alpha3D.py Lines: 134, 135
OpenGLContext tests/redbook_surface.py Lines: 73
OpenGLContext tests/redbook_surface_cb.py Lines: 90
OpenGLContext tests/redbook_trim.py Lines: 100
OpenGL-Demo PyOpenGL-Demo/redbook/double.py Lines: 71
OpenGL-Demo PyOpenGL-Demo/redbook/scene.py Lines: 85, 88, 94
OpenGL-Demo PyOpenGL-Demo/GLUT/molehill.py Lines: 136
OpenGL-Demo PyOpenGL-Demo/GLUT/glutplane.py Lines: 66, 67
OpenGL-Demo PyOpenGL-Demo/GLUT/gears.py Lines: 137, 138, 139, 143, 149, 155
OpenGL-Demo PyOpenGL-Demo/GLUT/tom/cone.py Lines: 26
OpenGL-Demo PyOpenGL-Demo/proesch/nurbs/nurbs.py Lines: 148, 149
OpenGL-Demo PyOpenGL-Demo/proesch/bezier/bezier.py Lines: 94, 95
OpenGL-Demo PyOpenGL-Demo/GLE/texas.py Lines: 47, 48
OpenGL-Demo PyOpenGL-Demo/GLE/helix.py Lines: 19, 20
OpenGL-Demo PyOpenGL-Demo/GLE/cone.py Lines: 21, 22
OpenGL-Demo PyOpenGL-Demo/tom/conechecker.py Lines: 53
OpenGL-Demo PyOpenGL-Demo/tom/cone.py Lines: 32
OpenGL-Demo PyOpenGL-Demo/tom/conesave.py Lines: 34
OpenGL-Demo PyOpenGL-Demo/NeHe/lesson5.py Lines: 94, 131
OpenGL-Demo PyOpenGL-Demo/NeHe/lesson45.py Lines: 419, 420
OpenGL-Demo PyOpenGL-Demo/NeHe/lesson18.py Lines: 190, 191, 192
OpenGL-Demo PyOpenGL-Demo/NeHe/lesson4.py Lines: 96, 115
OpenGL-Demo PyOpenGL-Demo/NeHe/lesson12.py Lines: 118, 119
OpenGL-Demo PyOpenGL-Demo/NeHe/lesson26.py Lines: 168, 169, 188, 189
OpenGL-Demo PyOpenGL-Demo/NeHe/lesson11.py Lines: 80, 81, 82
OpenGL-Demo PyOpenGL-Demo/NeHe/lesson23.py Lines: 148, 149, 150
OpenGL-Demo PyOpenGL-Demo/NeHe/lesson6.py Lines: 116, 117, 118
OpenGL-Demo PyOpenGL-Demo/NeHe/lesson16.py Lines: 99, 100, 101
OpenGL-Demo PyOpenGL-Demo/NeHe/lesson42.py Lines: 321, 322, 323, 331, 332, 346, 347, 348
OpenGL-Demo PyOpenGL-Demo/NeHe/lesson6-multi.py Lines: 153, 154, 155
OpenGL-Demo PyOpenGL-Demo/NeHe/lesson44/lesson44.py Lines: 364, 365
OpenGL-Demo PyOpenGL-Demo/NeHe/lesson44/glCamera.py Lines: 697, 698, 723, 724, 743, 744
{Artistic License} PymmLib mmLib/OpenGLDriver.py Lines: 270
{LGPL} VisionEgg VisionEgg/SphereMap.py Lines: 253, 254, 541, 542, 837, 838, 841, 1213, 1214
{LGPL} VisionEgg VisionEgg/Textures.py Lines: 1744, 1828, 1829, 1832, 1836
{LGPL} VisionEgg VisionEgg/Core.py Lines: 835
{LGPL} VisionEgg test/conform.py Lines: 188, 218
{LGPL} PyMT examples/apps/3Dviewer/3Dviewer.py Lines: 90, 156, 157, 158
{LGPL} PyMT examples/apps/3Ddrawing/3Ddrawing.py Lines: 111, 112, 113, 137
{LGPL} PyMT pymt/lib/squirtle.py Lines: 16, 492
{LGPL} PyMT pymt/ui/widgets/flippable.py Lines: 8, 139, 141
{LGPL} PyMT pymt/ui/widgets/objectdisplay.py Lines: 7, 39
{LGPL} PyMT pymt/ui/widgets/circularslider.py Lines: 8, 149
{LGPL} PyMT pymt/ui/widgets/coverflow.py Lines: 7, 273, 316
{LGPL} PyMT pymt/ui/window/__init__.py Lines: 20, 469
{GPL} GLChess src/lib/scene/opengl/opengl.py Lines: 701, 906
{GPL} GLChess src/lib/scene/opengl/builtin_models.py Lines: 92
{GPL} GLChess src/lib/scene/opengl/new_models.py Lines: 108
{LGPL} Pyggel pyggel/geometry.py Lines: 142, 143, 144, 297, 298, 299, 447, 448, 449, 576, 577, 578
{LGPL} Pyggel pyggel/font.py Lines: 313, 314, 315, 520, 521, 522, 953, 954, 955, 995, 996, 997
{LGPL} Pyggel pyggel/misc.py Lines: 216, 217, 218, 327, 328, 329
{LGPL} Pyggel pyggel/camera.py Lines: 58, 59, 60, 77, 78, 79, 83, 84, 85, 102, 103, 104, 109, 110, 111, 115, 116, 117
{LGPL} Pyggel pyggel/image.py Lines: 94, 95, 96, 162, 163, 164
{LGPL} Pyggel pyggel/mesh.py Lines: 213, 214, 215, 304, 305, 306, 761, 762, 763
{LGPL} pygl2d pygl2d/image.py Lines: 179
{LGPL or GPL or MPL} Kamaelia Sketches/CL/Topology3D/Utils/Particles3D.py Lines: 316
{LGPL or GPL or MPL} Kamaelia Sketches/CL/Topology3D/Experiments/Spheres.py Lines: 101, 102, 103
{LGPL or GPL or MPL} Kamaelia Sketches/CL/Topology3D/Experiments/Cubes.py Lines: 162, 163