Commit | Line | Data |
---|---|---|
7faf1d71 AW |
1 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "xhtml1-transitional.dtd"> |
2 | <!-- saved from url=(0013)about:internet --> | |
3 | <?xml-stylesheet type="text/xsl" href="mathml.xsl"?><html xmlns="http://www.w3.org/1999/xhtml" xmlns:pref="http://www.w3.org/2002/Math/preference" pref:renderer="mathplayer-dl"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>glRotate</title><meta name="generator" content="DocBook XSL Stylesheets V1.73.2" /></head><body><div class="refentry" lang="en" xml:lang="en"><a id="glRotate"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>glRotate — multiply the current matrix by a rotation matrix</p></div><div class="refsynopsisdiv"><h2>C Specification</h2><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0"><tr><td><code class="funcdef">void <b class="fsfunc">glRotated</b>(</code></td><td>GLdouble </td><td><var class="pdparam">angle</var>, </td></tr><tr><td> </td><td>GLdouble </td><td><var class="pdparam">x</var>, </td></tr><tr><td> </td><td>GLdouble </td><td><var class="pdparam">y</var>, </td></tr><tr><td> </td><td>GLdouble </td><td><var class="pdparam">z</var><code>)</code>;</td></tr></table></div><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0"><tr><td><code class="funcdef">void <b class="fsfunc">glRotatef</b>(</code></td><td>GLfloat </td><td><var class="pdparam">angle</var>, </td></tr><tr><td> </td><td>GLfloat </td><td><var class="pdparam">x</var>, </td></tr><tr><td> </td><td>GLfloat </td><td><var class="pdparam">y</var>, </td></tr><tr><td> </td><td>GLfloat </td><td><var class="pdparam">z</var><code>)</code>;</td></tr></table></div></div><div class="refsect1" lang="en" xml:lang="en"><a id="parameters"></a><h2>Parameters</h2><div class="variablelist"><dl><dt><span class="term"><em class="parameter"><code>angle</code></em></span></dt><dd><p> | |
4 | Specifies the angle of rotation, in degrees. | |
5 | </p></dd><dt><span class="term"><em class="parameter"><code>x</code></em>, </span><span class="term"><em class="parameter"><code>y</code></em>, </span><span class="term"><em class="parameter"><code>z</code></em></span></dt><dd><p> | |
6 | Specify the <span class="emphasis"><em>x</em></span>, <span class="emphasis"><em>y</em></span>, and <span class="emphasis"><em>z</em></span> coordinates of a vector, respectively. | |
7 | </p></dd></dl></div></div><div class="refsect1" lang="en" xml:lang="en"><a id="description"></a><h2>Description</h2><p> | |
8 | <code class="function">glRotate</code> produces a rotation of <em class="parameter"><code>angle</code></em> degrees around | |
9 | the vector | |
10 | <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"> | |
11 | ||
12 | <mml:mfenced open="(" close=")"> | |
13 | <mml:mi mathvariant="italic">x</mml:mi> | |
14 | <mml:mi mathvariant="italic">y</mml:mi> | |
15 | <mml:mi mathvariant="italic">z</mml:mi> | |
16 | </mml:mfenced> | |
17 | </mml:math>. | |
18 | The current matrix (see <a class="citerefentry" href="glMatrixMode.xml"><span class="citerefentry"><span class="refentrytitle">glMatrixMode</span></span></a>) is multiplied by a rotation | |
19 | matrix with the product | |
20 | replacing the current matrix, as if <a class="citerefentry" href="glMultMatrix.xml"><span class="citerefentry"><span class="refentrytitle">glMultMatrix</span></span></a> were called | |
21 | with the following matrix as its argument: | |
22 | </p><p> | |
23 | </p><div class="informalequation"><mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"> | |
24 | ||
25 | <mml:mfenced open="(" close=")"> | |
26 | <mml:mtable> | |
27 | <mml:mtr> | |
28 | <mml:mtd> | |
29 | <mml:mrow> | |
30 | <mml:mrow> | |
31 | <mml:msup><mml:mi mathvariant="italic">x</mml:mi> | |
32 | <mml:mn>2</mml:mn> | |
33 | </mml:msup> | |
34 | <mml:mo></mml:mo> | |
35 | <mml:mfenced open="(" close=")"> | |
36 | <mml:mrow> | |
37 | <mml:mn>1</mml:mn> | |
38 | <mml:mo>-</mml:mo> | |
39 | <mml:mi mathvariant="italic">c</mml:mi> | |
40 | </mml:mrow> | |
41 | </mml:mfenced> | |
42 | </mml:mrow> | |
43 | <mml:mo>+</mml:mo> | |
44 | <mml:mi mathvariant="italic">c</mml:mi> | |
45 | </mml:mrow> | |
46 | </mml:mtd> | |
47 | <mml:mtd> | |
48 | <mml:mrow> | |
49 | <mml:mi mathvariant="italic">x</mml:mi> | |
50 | <mml:mo></mml:mo> | |
51 | <mml:mrow> | |
52 | <mml:mi mathvariant="italic">y</mml:mi> | |
53 | <mml:mo></mml:mo> | |
54 | <mml:mfenced open="(" close=")"> | |
55 | <mml:mrow> | |
56 | <mml:mn>1</mml:mn> | |
57 | <mml:mo>-</mml:mo> | |
58 | <mml:mi mathvariant="italic">c</mml:mi> | |
59 | </mml:mrow> | |
60 | </mml:mfenced> | |
61 | </mml:mrow> | |
62 | <mml:mo>-</mml:mo> | |
63 | <mml:mi mathvariant="italic">z</mml:mi> | |
64 | <mml:mo></mml:mo> | |
65 | <mml:mi mathvariant="italic">s</mml:mi> | |
66 | </mml:mrow> | |
67 | </mml:mtd> | |
68 | <mml:mtd> | |
69 | <mml:mrow> | |
70 | <mml:mi mathvariant="italic">x</mml:mi> | |
71 | <mml:mo></mml:mo> | |
72 | <mml:mrow> | |
73 | <mml:mi mathvariant="italic">z</mml:mi> | |
74 | <mml:mo></mml:mo> | |
75 | <mml:mfenced open="(" close=")"> | |
76 | <mml:mrow> | |
77 | <mml:mn>1</mml:mn> | |
78 | <mml:mo>-</mml:mo> | |
79 | <mml:mi mathvariant="italic">c</mml:mi> | |
80 | </mml:mrow> | |
81 | </mml:mfenced> | |
82 | </mml:mrow> | |
83 | <mml:mo>+</mml:mo> | |
84 | <mml:mi mathvariant="italic">y</mml:mi> | |
85 | <mml:mo></mml:mo> | |
86 | <mml:mi mathvariant="italic">s</mml:mi> | |
87 | </mml:mrow> | |
88 | </mml:mtd> | |
89 | <mml:mtd> | |
90 | <mml:mn>0</mml:mn> | |
91 | </mml:mtd> | |
92 | </mml:mtr> | |
93 | <mml:mtr> | |
94 | <mml:mtd> | |
95 | <mml:mrow> | |
96 | <mml:mi mathvariant="italic">y</mml:mi> | |
97 | <mml:mo></mml:mo> | |
98 | <mml:mrow> | |
99 | <mml:mi mathvariant="italic">x</mml:mi> | |
100 | <mml:mo></mml:mo> | |
101 | <mml:mfenced open="(" close=")"> | |
102 | <mml:mrow> | |
103 | <mml:mn>1</mml:mn> | |
104 | <mml:mo>-</mml:mo> | |
105 | <mml:mi mathvariant="italic">c</mml:mi> | |
106 | </mml:mrow> | |
107 | </mml:mfenced> | |
108 | </mml:mrow> | |
109 | <mml:mo>+</mml:mo> | |
110 | <mml:mi mathvariant="italic">z</mml:mi> | |
111 | <mml:mo></mml:mo> | |
112 | <mml:mi mathvariant="italic">s</mml:mi> | |
113 | </mml:mrow> | |
114 | </mml:mtd> | |
115 | <mml:mtd> | |
116 | <mml:mrow> | |
117 | <mml:mrow> | |
118 | <mml:msup><mml:mi mathvariant="italic">y</mml:mi> | |
119 | <mml:mn>2</mml:mn> | |
120 | </mml:msup> | |
121 | <mml:mo></mml:mo> | |
122 | <mml:mfenced open="(" close=")"> | |
123 | <mml:mrow> | |
124 | <mml:mn>1</mml:mn> | |
125 | <mml:mo>-</mml:mo> | |
126 | <mml:mi mathvariant="italic">c</mml:mi> | |
127 | </mml:mrow> | |
128 | </mml:mfenced> | |
129 | </mml:mrow> | |
130 | <mml:mo>+</mml:mo> | |
131 | <mml:mi mathvariant="italic">c</mml:mi> | |
132 | </mml:mrow> | |
133 | </mml:mtd> | |
134 | <mml:mtd> | |
135 | <mml:mrow> | |
136 | <mml:mi mathvariant="italic">y</mml:mi> | |
137 | <mml:mo></mml:mo> | |
138 | <mml:mrow> | |
139 | <mml:mi mathvariant="italic">z</mml:mi> | |
140 | <mml:mo></mml:mo> | |
141 | <mml:mfenced open="(" close=")"> | |
142 | <mml:mrow> | |
143 | <mml:mn>1</mml:mn> | |
144 | <mml:mo>-</mml:mo> | |
145 | <mml:mi mathvariant="italic">c</mml:mi> | |
146 | </mml:mrow> | |
147 | </mml:mfenced> | |
148 | </mml:mrow> | |
149 | <mml:mo>-</mml:mo> | |
150 | <mml:mi mathvariant="italic">x</mml:mi> | |
151 | <mml:mo></mml:mo> | |
152 | <mml:mi mathvariant="italic">s</mml:mi> | |
153 | </mml:mrow> | |
154 | </mml:mtd> | |
155 | <mml:mtd> | |
156 | <mml:mn>0</mml:mn> | |
157 | </mml:mtd> | |
158 | </mml:mtr> | |
159 | <mml:mtr> | |
160 | <mml:mtd> | |
161 | <mml:mrow> | |
162 | <mml:mi mathvariant="italic">x</mml:mi> | |
163 | <mml:mo></mml:mo> | |
164 | <mml:mrow> | |
165 | <mml:mi mathvariant="italic">z</mml:mi> | |
166 | <mml:mo></mml:mo> | |
167 | <mml:mfenced open="(" close=")"> | |
168 | <mml:mrow> | |
169 | <mml:mn>1</mml:mn> | |
170 | <mml:mo>-</mml:mo> | |
171 | <mml:mi mathvariant="italic">c</mml:mi> | |
172 | </mml:mrow> | |
173 | </mml:mfenced> | |
174 | </mml:mrow> | |
175 | <mml:mo>-</mml:mo> | |
176 | <mml:mi mathvariant="italic">y</mml:mi> | |
177 | <mml:mo></mml:mo> | |
178 | <mml:mi mathvariant="italic">s</mml:mi> | |
179 | </mml:mrow> | |
180 | </mml:mtd> | |
181 | <mml:mtd> | |
182 | <mml:mrow> | |
183 | <mml:mi mathvariant="italic">y</mml:mi> | |
184 | <mml:mo></mml:mo> | |
185 | <mml:mrow> | |
186 | <mml:mi mathvariant="italic">z</mml:mi> | |
187 | <mml:mo></mml:mo> | |
188 | <mml:mfenced open="(" close=")"> | |
189 | <mml:mrow> | |
190 | <mml:mn>1</mml:mn> | |
191 | <mml:mo>-</mml:mo> | |
192 | <mml:mi mathvariant="italic">c</mml:mi> | |
193 | </mml:mrow> | |
194 | </mml:mfenced> | |
195 | </mml:mrow> | |
196 | <mml:mo>+</mml:mo> | |
197 | <mml:mi mathvariant="italic">x</mml:mi> | |
198 | <mml:mo></mml:mo> | |
199 | <mml:mi mathvariant="italic">s</mml:mi> | |
200 | </mml:mrow> | |
201 | </mml:mtd> | |
202 | <mml:mtd> | |
203 | <mml:mrow> | |
204 | <mml:mrow> | |
205 | <mml:msup><mml:mi mathvariant="italic">z</mml:mi> | |
206 | <mml:mn>2</mml:mn> | |
207 | </mml:msup> | |
208 | <mml:mo></mml:mo> | |
209 | <mml:mfenced open="(" close=")"> | |
210 | <mml:mrow> | |
211 | <mml:mn>1</mml:mn> | |
212 | <mml:mo>-</mml:mo> | |
213 | <mml:mi mathvariant="italic">c</mml:mi> | |
214 | </mml:mrow> | |
215 | </mml:mfenced> | |
216 | </mml:mrow> | |
217 | <mml:mo>+</mml:mo> | |
218 | <mml:mi mathvariant="italic">c</mml:mi> | |
219 | </mml:mrow> | |
220 | </mml:mtd> | |
221 | <mml:mtd> | |
222 | <mml:mn>0</mml:mn> | |
223 | </mml:mtd> | |
224 | </mml:mtr> | |
225 | <mml:mtr> | |
226 | <mml:mtd> | |
227 | <mml:mn>0</mml:mn> | |
228 | </mml:mtd> | |
229 | <mml:mtd> | |
230 | <mml:mn>0</mml:mn> | |
231 | </mml:mtd> | |
232 | <mml:mtd> | |
233 | <mml:mn>0</mml:mn> | |
234 | </mml:mtd> | |
235 | <mml:mtd> | |
236 | <mml:mn>1</mml:mn> | |
237 | </mml:mtd> | |
238 | </mml:mtr> | |
239 | </mml:mtable> | |
240 | </mml:mfenced> | |
241 | </mml:math></div><p> | |
242 | </p><p> | |
243 | </p><p> | |
244 | Where | |
245 | <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"> | |
246 | ||
247 | <mml:mrow> | |
248 | <mml:mi mathvariant="italic">c</mml:mi> | |
249 | <mml:mo>=</mml:mo> | |
250 | <mml:mrow> | |
251 | <mml:mi mathvariant="italic">cos</mml:mi> | |
252 | <mml:mo></mml:mo> | |
253 | <mml:mfenced open="(" close=")"> | |
254 | <mml:mi mathvariant="italic">angle</mml:mi> | |
255 | </mml:mfenced> | |
256 | </mml:mrow> | |
257 | </mml:mrow> | |
258 | </mml:math>, | |
259 | <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"> | |
260 | ||
261 | <mml:mrow> | |
262 | <mml:mi mathvariant="italic">s</mml:mi> | |
263 | <mml:mo>=</mml:mo> | |
264 | <mml:mrow> | |
265 | <mml:mi mathvariant="italic">sin</mml:mi> | |
266 | <mml:mo></mml:mo> | |
267 | <mml:mfenced open="(" close=")"> | |
268 | <mml:mi mathvariant="italic">angle</mml:mi> | |
269 | </mml:mfenced> | |
270 | </mml:mrow> | |
271 | </mml:mrow> | |
272 | </mml:math>, | |
273 | and | |
274 | <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"> | |
275 | ||
276 | <mml:mrow> | |
277 | <mml:mfenced open="∥" close="∥"> | |
278 | <mml:mfenced open="(" close=")"> | |
279 | <mml:mi mathvariant="italic">x</mml:mi> | |
280 | <mml:mi mathvariant="italic">y</mml:mi> | |
281 | <mml:mi mathvariant="italic">z</mml:mi> | |
282 | </mml:mfenced> | |
283 | </mml:mfenced> | |
284 | <mml:mo>=</mml:mo> | |
285 | <mml:mn>1</mml:mn> | |
286 | </mml:mrow> | |
287 | </mml:math> | |
288 | (if not, the GL | |
289 | will normalize this vector). | |
290 | </p><p> | |
291 | </p><p> | |
292 | </p><p> | |
293 | If the matrix mode is either <code class="constant">GL_MODELVIEW</code> or <code class="constant">GL_PROJECTION</code>, | |
294 | all objects drawn after <code class="function">glRotate</code> is called are rotated. | |
295 | Use <a class="citerefentry" href="glPushMatrix.xml"><span class="citerefentry"><span class="refentrytitle">glPushMatrix</span></span></a> and <a class="citerefentry" href="glPopMatrix.xml"><span class="citerefentry"><span class="refentrytitle">glPopMatrix</span></span></a> to save and restore | |
296 | the unrotated coordinate system. | |
297 | </p></div><div class="refsect1" lang="en" xml:lang="en"><a id="notes"></a><h2>Notes</h2><p> | |
298 | This rotation follows the right-hand rule, so | |
299 | if the vector | |
300 | <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"> | |
301 | ||
302 | <mml:mfenced open="(" close=")"> | |
303 | <mml:mi mathvariant="italic">x</mml:mi> | |
304 | <mml:mi mathvariant="italic">y</mml:mi> | |
305 | <mml:mi mathvariant="italic">z</mml:mi> | |
306 | </mml:mfenced> | |
307 | </mml:math> | |
308 | points toward the | |
309 | user, the rotation will be counterclockwise. | |
310 | </p></div><div class="refsect1" lang="en" xml:lang="en"><a id="errors"></a><h2>Errors</h2><p> | |
311 | <code class="constant">GL_INVALID_OPERATION</code> is generated if <code class="function">glRotate</code> | |
312 | is executed between the execution of <a class="citerefentry" href="glBegin.xml"><span class="citerefentry"><span class="refentrytitle">glBegin</span></span></a> | |
313 | and the corresponding execution of <a class="citerefentry" href="glEnd.xml"><span class="citerefentry"><span class="refentrytitle">glEnd</span></span></a>. | |
314 | </p></div><div class="refsect1" lang="en" xml:lang="en"><a id="associatedgets"></a><h2>Associated Gets</h2><p> | |
315 | <a class="citerefentry" href="glGet.xml"><span class="citerefentry"><span class="refentrytitle">glGet</span></span></a> with argument <code class="constant">GL_MATRIX_MODE</code> | |
316 | </p><p> | |
317 | <a class="citerefentry" href="glGet.xml"><span class="citerefentry"><span class="refentrytitle">glGet</span></span></a> with argument <code class="constant">GL_COLOR_MATRIX</code> | |
318 | </p><p> | |
319 | <a class="citerefentry" href="glGet.xml"><span class="citerefentry"><span class="refentrytitle">glGet</span></span></a> with argument <code class="constant">GL_MODELVIEW_MATRIX</code> | |
320 | </p><p> | |
321 | <a class="citerefentry" href="glGet.xml"><span class="citerefentry"><span class="refentrytitle">glGet</span></span></a> with argument <code class="constant">GL_PROJECTION_MATRIX</code> | |
322 | </p><p> | |
323 | <a class="citerefentry" href="glGet.xml"><span class="citerefentry"><span class="refentrytitle">glGet</span></span></a> with argument <code class="constant">GL_TEXTURE_MATRIX</code> | |
324 | </p></div><div class="refsect1" lang="en" xml:lang="en"><a id="seealso"></a><h2>See Also</h2><p> | |
325 | <a class="citerefentry" href="glMatrixMode.xml"><span class="citerefentry"><span class="refentrytitle">glMatrixMode</span></span></a>, | |
326 | <a class="citerefentry" href="glMultMatrix.xml"><span class="citerefentry"><span class="refentrytitle">glMultMatrix</span></span></a>, | |
327 | <a class="citerefentry" href="glPushMatrix.xml"><span class="citerefentry"><span class="refentrytitle">glPushMatrix</span></span></a>, | |
328 | <a class="citerefentry" href="glScale.xml"><span class="citerefentry"><span class="refentrytitle">glScale</span></span></a>, | |
329 | <a class="citerefentry" href="glTranslate.xml"><span class="citerefentry"><span class="refentrytitle">glTranslate</span></span></a> | |
330 | </p></div><div class="refsect1" lang="en" xml:lang="en"><a id="Copyright"></a><h2>Copyright</h2><p> | |
331 | Copyright <span class="trademark"></span>© 1991-2006 | |
332 | Silicon Graphics, Inc. This document is licensed under the SGI | |
333 | Free Software B License. For details, see | |
334 | <a class="ulink" href="http://oss.sgi.com/projects/FreeB/" target="_top">http://oss.sgi.com/projects/FreeB/</a>. | |
335 | </p></div></div></body></html> |