1 <!doctype html public "-//w3c//dtd html 4.0 transitional//en">
4 <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
5 <meta name="Author" content="John F. Fay">
6 <meta name="GENERATOR" content="Mozilla/4.77 [en] (Windows NT 5.0; U) [Netscape]">
7 <title>FREEGLUT Application Program Interface</title>
14 The Open-Source</h1></center>
18 OpenGL Utility Toolkit</h1></center>
22 (freeglut)</h1></center>
26 Application Programming Interface</h1></center>
31 Version 4.0</h1></center>
35 The freeglut Programming Consortium</h2></center>
39 November, 2002</h2></center>
41 <p><br>OpenGL is a trademark of Silicon Graphics, Inc. X Window System
42 is a trademark of X Consortium, Inc. Spaceball is a registered trademark
43 of Spatial Systems Inc.
44 <br>The authors have taken care in preparation of this documentation but
45 make no expressed or implied warranty of any kind and assumes no responsibility
46 for errors or omissions. No liability is assumed for incidental or consequential
47 damages in connection with or arising from the use of information or programs
51 1.0 <a NAME="Contents"></a> Contents</h1>
52 1.0 <a href="#Contents">Contents</a>
53 <p>2.0 <a href="#Introduction">Introduction</a>
54 <p>3.0 <a href="#Background">Background</a>
55 <blockquote>3.1 Design Philosophy
56 <br>3.2 Conventions
57 <br>3.3 Terminology
58 <br>3.4 Differences from GLUT 3.7</blockquote>
60 <p><br>4.0 <a href="#Initialization">Initialization Functions</a>
61 <blockquote>4.1 glutInit
62 <br>4.2 glutInitWindowPosition, glutInitWindowSize
63 <br>4.3 glutInitDisplayMode
64 <br>4.4 glutInitDisplayString</blockquote>
66 <p><br>5.0 <a href="#EventProcessing">Event Processing Functions</a>
67 <blockquote>5.1 glutMainLoop
68 <br>5.2 glutMainLoopEvent
69 <br>5.3 glutLeaveMainLoop</blockquote>
71 <p><br>6.0 <a href="#Window">Window Functions</a>
72 <blockquote>6.1 glutCreateWindow
73 <br>6.2 glutCreateSubwindow
74 <br>6.3 glutDestroyWindow
75 <br>6.4 glutSetWindow, glutGetWindow
76 <br>6.5 glutSetWindowTitle, glutSetIconTitle
77 <br>6.6 glutReshapeWindow
78 <br>6.7 glutPositionWindow
79 <br>6.8 glutShowWindow, glutHideWindow, glutIconifyWindow
80 <br>6.9 glutPushWindow, glutPopWindow
81 <br>6.10 glutFullScreen</blockquote>
83 <p><br>7.0 <a href="#Display">Display Functions</a>
84 <blockquote>7.1 glutPostRedisplay
85 <br>7.2 glutPostWindowRedisplay
86 <br>7.3 glutSwapBuffers</blockquote>
88 <p><br>8.0 <a href="#MouseCursor">Mouse Cursor Functions</a>
89 <blockquote>8.1 glutSetCursor
90 <br>8.2 glutWarpPointer</blockquote>
92 <p><br>9.0 <a href="#Overlay">Overlay Functions</a>
93 <blockquote>9.1 glutEstablishOverlay
94 <br>9.2 glutRemoveOverlay
95 <br>9.3 glutUseLayer
96 <br>9.4 glutPostOverlayRedisplay
97 <br>9.5 glutPostWindowOverlayRedisplay
98 <br>9.6 glutShowOverlay, glutHideOverlay</blockquote>
100 <p><br>10.0 <a href="#Menu">Menu Functions</a>
101 <blockquote>10.1 glutCreateMenu
102 <br>10.2 glutDestroyMenu
103 <br>10.3 glutGetMenu, glutSetMenu
104 <br>10.4 glutAddMenuEntry
105 <br>10.5 glutAddSubMenu
106 <br>10.6 glutChangeToMenuEntry
107 <br>10.7 glutChangeToSubMenu
108 <br>10.8 glutRemoveMenuItem
109 <br>10.9 glutAttachMenu, glutDetachMenu</blockquote>
111 <p><br>11.0 <a href="#GlobalCallback">Global Callback Registration
113 <blockquote>11.1 glutTimerFunc
114 <br>11.2 glutIdleFunc</blockquote>
116 <p><br>12.0 <a href="#WindowCallback">Window-Specific Callback Registration
118 <blockquote>12.1 glutDisplayFunc
119 <br>12.2 glutOverlayDisplayFunc
120 <br>12.3 glutReshapeFunc
121 <br>12.4 glutCloseFunc
122 <br>12.5 glutKeyboardFunc
123 <br>12.6 glutSpecialFunc
124 <br>12.7 glutKeyboardUpFunc
125 <br>12.8 glutSpecialUpFunc
126 <br>12.9 glutMouseFunc
127 <br>12.10 glutMotionFunc, glutPassiveMotionFunc
128 <br>12.11 glutVisibilityFunc
129 <br>12.12 glutEntryFunc
130 <br>12.13 glutJoystickFunc
131 <br>12.14 glutSpaceballMotionFunc
132 <br>12.15 glutSpaceballRotateFunc
133 <br>12.16 glutSpaceballButtonFunc
134 <br>12.17 glutButtonBoxFunc
135 <br>12.18 glutDialsFunc
136 <br>12.19 glutTabletMotionFunc
137 <br>12.20 glutTabletButtonFunc
138 <p>12.21 glutMenuStatusFunc
139 <br>12.22 glutWindowStatusFunc</blockquote>
141 <p><br>13.0 <a href="#StateSetting">State Setting and Retrieval Functions</a>
142 <blockquote>13.1 glutSetOption
143 <br>13.2 glutGet
144 <br>13.3 glutDeviceGet
145 <br>13.4 glutGetModifiers
146 <br>13.5 glutLayerGet
147 <br>13.6 glutExtensionSupported
148 <br>13.7 glutGetProcAddress</blockquote>
150 <p><br>14.0 <a href="#FontRendering">Font Rendering Functions</a>
151 <blockquote>14.1 glutBitmapCharacter
152 <br>14.2 glutBitmapString
153 <br>14.3 glutBitmapWidth
154 <br>14.4 glutBitmapLength
155 <br>14.5 glutBitmapHeight
156 <br>14.6 glutStrokeCharacter
157 <br>14.7 glutStrokeString
158 <br>14.8 glutStrokeWidth
159 <br>14.9 glutStrokeLength
160 <br>14.10 glutStrokeHeight</blockquote>
162 <p><br>15.0 <a href="#GeometricObject">Geometric Object Rendering
164 <blockquote>15.1 glutWireSphere, glutSolidSphere
165 <br>15.2 glutWireTorus, glutSolidTorus
166 <br>15.3 glutWireCone, glutSolidCone
167 <br>15.4 glutWireCube, glutSolidCube
168 <br>15.5 glutWireTetrahedron, glutSolidTetrahedron
169 <br>15.6 glutWireOctahedron, glutSolidOctahedron
170 <br>15.7 glutWireDodecahedron, glutSolidDodecahedron
171 <br>15.8 glutWireIcosahedron, glutSolidIcosahedron
172 <br>15.9 glutWireRhombicDodecahedron, glutSolidRhombicDodecahedron
173 <br>15.10 glutWireTeapot, glutSolidTeapot</blockquote>
175 <p><br>16.0 <a href="#GameMode">Game Mode Functions</a>
176 <blockquote>16.1 glutGameModeString
177 <br>16.2 glutEnterGameMode, glutLeaveGameMode
178 <br>16.3 glutGameModeGet</blockquote>
180 <p><br>17.0 <a href="#VideoResize">Video Resize Functions</a>
181 <blockquote>17.1 glutVideoResizeGet
182 <br>17.2 glutSetupVideoResizing, glutStopVideoResizing
183 <br>17.3 glutVideoResize
184 <br>17.4 glutVideoPan</blockquote>
186 <p><br>18.0 <a href="#ColorMap">Color Map Functions</a>
187 <blockquote>18.1 glutSetColor, glutGetColor
188 <br>18.2 glutCopyColormap</blockquote>
190 <p><br>19.0 <a href="#Miscellaneous">Miscellaneous Functions</a>
191 <blockquote>19.1 glutIgnoreKeyRepeat, glutSetKeyRepeat
192 <br>19.2 glutForceJoystickFunc
193 <br>19.3 glutReportErrors</blockquote>
195 <p><br>20.0 <a href="#UsageNotes">Usage Notes</a>
196 <p>21.0 <a href="#ImplementationNotes">Implementation Notes</a>
197 <p>22.0 <a href="#GLUT_State">GLUT State</a>
198 <p>23.0 <a href="#Freeglut.h_Header">"freeglut.h" Header File</a>
199 <p>24.0 <a href="#References">References</a>
200 <p>25.0 <a href="#Index">Index</a>
204 2.0 <a NAME="Introduction"></a> Introduction</h1>
207 3.0 <a NAME="Background"></a> Background</h1>
208 The OpenGL programming world owes a tremendous debt to Mr. Mark J. Kilgard
209 for writing the OpenGL Utility Toolkit, or GLUT. The GLUT library
210 of functions allows an application programmer to create, control, and manipulate
211 windows independent of what operating system the program is running on.
212 By hiding the dependency on the operating system from the application programmer,
213 he allowed people to write truly portable OpenGL applications.
214 <p> Mr. Kilgard copyrighted his library and gave it a
215 rather unusual license. Under his license, people are allowed freely
216 to copy and distribute the libraries and the source code, but they are
217 not allowed to modify it. For a long time this did not matter because
218 the GLUT library worked so well and because Mr. Kilgard was releasing updates
219 on a regular basis. But with the passage of time, people started
220 wanting some slightly different behaviours in their windowing system.
221 When Mr. Kilgard stopped supporting the GLUT library in 1999, having moved
222 on to bigger and better things, this started to become a problem.
223 <p> In December 1999, Mr. Pawel Olzsta started work on
224 an open-source clone of the GLUT library. This open-source clone,
225 which does not use any of the GLUT source code, has evolved into the present
227 library. This documentation specifies the application program interface
228 to the <i>freeglut</i> library.
230 3.1 Design Philosophy</h2>
233 3.2 Conventions</h2>
236 3.3 Terminology</h2>
239 3.4 Differences from GLUT 3.7</h2>
240 Since the <i>freeglut</i> library was developed in order to update GLUT,
241 it is natural that there will be some differences between the two.
242 Each function in the API notes any differences between the GLUT and the
244 function behaviours. The important ones are summarized here.
246 3.4.1 glutMainLoop Behaviour</h3>
247 One of the commonest complaints about the GLUT library was that once an
248 application called "<tt>glutMainLoop</tt>", it never got control back.
249 There was no way for an application to loop in GLUT for a while, possibly
250 as a subloop while a specific window was open, and then return to the calling
251 function. A new function, "<tt>glutMainLoopEvent</tt>", has been
252 added to allow this functionality. Another function, "<tt>glutLeaveMainLoop</tt>",
253 has also been added to allow the application to tell freeglut to clean
256 3.4.2 Action on Window Closure</h3>
257 Another difficulty with GLUT, especially with multiple-window programs,
258 is that if the user clicks on the "x" in the window header the application
259 exits immediately. The application programmer can now set an option,
260 "<tt> GLUT_ACTION_ON_WINDOW_CLOSE</tt>", to specify whether execution should
261 continue, whether GLUT should return control to the main program, or whether
262 GLUT should simply exit (the default).
264 3.4.3 String Rendering</h3>
265 New functions have been added to render full character strings (including
266 carriage returns) rather than rendering one character at a time.
267 More functions return the widths of character strings and the font heights,
268 in pixels for bitmapped fonts and in OpenGL units for the stroke fonts.
270 3.4.4 Geometry Rendering</h3>
271 Two functions have been added to render a wireframe and a solid rhombic
274 3.4.5 Extension Function Queries</h3>
275 glutGetProcAddress is a wrapper for the glXGetProcAddressARB and
276 wglGetProcAddress functions.
282 4.0 <a NAME="Initialization"></a> Initialization Functions</h1>
285 4.1 glutInit</h2>
288 4.2 glutInitWindowPosition, glutInitWindowSize</h2>
289 The "<tt>glutInitWindowPosition</tt> " and "<tt>glutInitWindowSize</tt>"
290 functions specify a desired position and size for windows that <i>freeglut</i>
291 will create in the future.
293 <p><tt>void glutInitWindowPosition ( int x, int y ) ;</tt>
294 <br><tt>void glutInitWindowSize ( int width, int height ) ;</tt>
295 <p><b>Description</b>
296 <p>The "<tt>glutInitWindowPosition</tt> " and "<tt>glutInitWindowSize</tt>"
297 functions specify a desired position and size for windows that <i>freeglut</i>
298 will create in the future. The position is measured in pixels from
299 the upper left hand corner of the screen, with "x" increasing to the right
300 and "y" increasing towards the bottom of the screen. The size is
301 measured in pixels. <i>Freeglut</i> does not promise to follow these
302 specifications in creating its windows, it certainly makes an attempt to.
303 <p>The position and size of a window are a matter of some subtlety.
304 Most windows have a usable area surrounded by a border and with a title
305 bar on the top. The border and title bar are commonly called "decorations."
306 The position of the window unfortunately varies with the operating system.
307 On Linux, it is the coordinates of the upper left-hand corner of its decorations.
308 On Windows, it is the coordinates of the upper left hand corner of its
309 usable interior. For both operating systems, the size of the window
310 is the size of the usable interior.
311 <p>Windows has some additional quirks which the application programmer
312 should know about. First, the minimum y-coordinate of a window decoration
313 is zero. (This is a feature of <i>freeglut</i> and can be adjusted
314 if so desired.) Second, there appears to be a minimum window width
315 on Windows which is 104 pixels. The user may specify a smaller width,
316 but the Windows system calls ignore it. It is also impossible to
317 make a window narrower than this by dragging on its corner.
318 <p><b>Changes From GLUT</b>
319 <p>For some reason, GLUT is not affected by the 104-pixel minimum window
320 width. If the user clicks on the corner of a window which is narrower
321 than this amount, the window will immediately snap out to this width, but
322 the application can call "<tt>glutReshapeWindow</tt> " and make a window
325 4.3 glutInitDisplayMode</h2>
328 4.4 glutInitDisplayString</h2>
331 5.0 <a NAME="EventProcessing"></a> Event Processing Functions</h1>
332 After an application has finished initializing its windows and menus, it
333 enters an event loop. Within this loop, <i>freeglut</i> polls the
334 data entry devices (keyboard, mouse, etc.) and calls the application's
335 appropriate callbacks.
336 <p>In GLUT, control never returned from the event loop (as invoked by the
337 "<tt>glutMainLoop</tt>" function) to the calling function. This prevented
338 an application from having re-entrant code, in which GLUT could be invoked
339 from within a callback, and it prevented the application from doing any
340 post-processing (such as freeing allocated memory) after GLUT had closed
341 down. <i>Freeglut</i> allows the application programmer to specify
342 more direct control over the event loop by means of two new functions.
343 The first, "<tt>glutMainLoopEvent</tt>", processes a single iteration of
344 the event loop and allows the application to use a different event loop
345 controller or to contain re-entrant code. The second, "<tt>glutLeaveMainLoop</tt>",
346 causes the event loop to exit nicely; this is preferable to the application's
347 calling "<tt>exit</tt>" from within a GLUT callback.
349 5.1 glutMainLoop</h2>
350 The "<tt>glutMainLoop</tt>" function enters the event loop.
352 <p><tt>void glutMainLoop ( void ) ;</tt>
353 <p><b>Description</b>
354 <p>The "<tt>glutMainLoop</tt>" function causes the program to enter
355 the window event loop. An application should call this function at
356 most once. It will call any application callback functions as required
357 to process mouse clicks, mouse motion, key presses, and so on.
358 <p><b>Changes From GLUT</b>
359 <p>In GLUT, there was absolutely no way for the application programmer
360 to have control return from the "<tt>glutMainLoop</tt> " function to the
361 calling function. <i>Freeglut</i> allows the programmer to force
362 this by setting the "<tt>GLUT_ACTION_ON_WINDOW_CLOSE</tt>" option and invoking
363 the "<tt>glutLeaveMainLoop</tt>" function from one of the callbacks.
364 Stopping the program this way is preferable to simply calling "<tt>exit</tt>
365 " from within a callback because this allows <i>freeglut</i> to free allocated
366 memory and otherwise clean up after itself. (I know I just said this,
367 but I think it is important enough that it bears repeating.)
369 5.2 glutMainLoopEvent</h2>
370 The "<tt>glutMainLoopEvent</tt>" function processes a single iteration
371 in the <i>freeglut</i> event loop.
373 <p><tt>void glutMainLoopEvent ( void ) ;</tt>
374 <p><b>Description</b>
375 <p>The "<tt>glutMainLoopEvent</tt> " function causes <i>freeglut</i>
376 to process one iteration's worth of events in its event loop. This
377 allows the application to control its own event loop and still use the
380 <p><b>Changes From GLUT</b>
381 <p>GLUT does not include this function.
383 5.3 glutLeaveMainLoop</h2>
384 The "<tt>glutLeaveMainLoop</tt>" function causes <i>freeglut</i> to stop
387 <p><tt>void glutLeaveMainLoop ( void ) ;</tt>
388 <p><b>Description</b>
389 <p>The "<tt>glutLeaveMainLoop</tt> " function causes <i>freeglut</i>
390 to stop the event loop. If the "<tt> GLUT_ACTION_ON_WINDOW_CLOSE</tt>"
391 option has been set to "<tt>GLUT_ACTION_CONTINUE_EXECUTION</tt> ", control
392 will return to the function which called "<tt>glutMainLoop</tt> "; otherwise
393 the application will exit.
394 <p>If the application has two nested calls to "<tt>glutMainLoop</tt>" and
395 calls "<tt>glutLeaveMainLoop</tt>", the behaviour of <i>freeglut</i> is
396 undefined. It may leave only the inner nested loop or it may leave
397 both loops. If the reader has a strong preference for one behaviour
398 over the other he should contact the <i>freeglut</i> Programming Consortium
399 and ask for the code to be fixed.
400 <p><b>Changes From GLUT</b>
401 <p>GLUT does not include this function.
403 6.0 <a NAME="Window"></a> Window Functions</h1>
406 6.1 glutCreateWindow</h2>
409 6.2 glutCreateSubwindow</h2>
412 6.3 glutDestroyWindow</h2>
415 6.4 glutSetWindow, glutGetWindow</h2>
418 6.5 glutSetWindowTitle, glutSetIconTitle</h2>
421 6.6 glutReshapeWindow</h2>
424 6.7 glutPositionWindow</h2>
427 6.8 glutShowWindow, glutHideWindow, glutIconifyWindow</h2>
430 6.9 glutPushWindow, glutPopWindow</h2>
433 6.10 glutFullScreen</h2>
436 7.0 <a NAME="Display"></a> Display Functions</h1>
439 7.1 glutPostRedisplay</h2>
442 7.2 glutPostWindowRedisplay</h2>
445 7.3 glutSwapBuffers</h2>
448 8.0 <a NAME="MouseCursor"></a> Mouse Cursor Functions</h1>
451 8.1 glutSetCursor</h2>
454 8.2 glutWarpPointer</h2>
457 9.0 <a NAME="Overlay"></a> Overlay Functions</h1>
458 <i>Freeglut</i> does not allow overlays, although it does "answer the mail"
459 with function stubs so that GLUT-based programs can compile and link against
461 without modification. If the reader needs overlays, he should contact
462 the <i>freeglut</i> Programming Consortium and ask for them to be implemented.
463 He should also be prepared to assist in the implementation.
465 9.1 glutEstablishOverlay</h2>
466 The "<tt>glutEstablishOverlay</tt>" function is not implemented in <i>freeglut</i>.
468 <p><tt>void glutEstablishOverlay ( void ) ;</tt>
469 <p><b>Description</b>
470 <p>The "<tt>glutEstablishOverlay</tt>" function is not implemented in <i>freeglut</i>.
471 <p><b>Changes From GLUT</b>
472 <p>GLUT implements this function.
474 9.2 glutRemoveOverlay</h2>
475 The "<tt>glutRemoveOverlay</tt>" function is not implemented in <i>freeglut</i>.
477 <p><tt>void glutRemoveOverlay ( void ) ;</tt>
478 <p><b>Description</b>
479 <p>The "<tt>glutRemoveOverlay</tt>" function is not implemented in <i>freeglut</i>.
480 <p><b>Changes From GLUT</b>
481 <p>GLUT implements this function.
483 9.3 glutUseLayer</h2>
484 The "<tt>glutUseLayer</tt>" function is not implemented in <i>freeglut</i>.
486 <p><tt>void glutUseLayer ( GLenum layer ) ;</tt>
487 <p><b>Description</b>
488 <p>The "<tt>glutUseLayer</tt>" function is not implemented in <i>freeglut</i>.
489 <p><b>Changes From GLUT</b>
490 <p>GLUT implements this function.
492 9.4 glutPostOverlayRedisplay</h2>
493 The "<tt>glutPostOverlayRedisplay</tt> " function is not implemented in
496 <p><tt>void glutPostOverlayRedisplay ( void ) ;</tt>
497 <p><b>Description</b>
498 <p>The "<tt>glutPostOverlayRedisplay</tt> " function is not implemented
500 <p><b>Changes From GLUT</b>
501 <p>GLUT implements this function.
503 9.5 glutPostWindowOverlayRedisplay</h2>
504 The "<tt>glutPostWindowOverlayRedisplay</tt> " function is not implemented
507 <p><tt>void glutPostWindowOverlayRedisplay ( int window ) ;</tt>
508 <p><b>Description</b>
509 <p>The "<tt>glutPostWindowOverlayRedisplay</tt> " function is not implemented
511 <p><b>Changes From GLUT</b>
512 <p>GLUT implements this function.
514 9.6 glutShowOverlay, glutHideOverlay</h2>
515 The "<tt>glutShowOverlay</tt>" and "<tt>glutHideOverlay</tt>" functions
516 are not implemented in <i>freeglut</i> .
518 <p><tt>void glutShowOverlay( void ) ;</tt>
519 <br><tt>void glutHideOverlay( void ) ;</tt>
520 <p><b>Description</b>
521 <p>The "<tt>glutShowOverlay</tt>" and "<tt>glutHideOverlay</tt>" functions
522 are not implemented in <i>freeglut</i> .
523 <p><b>Changes From GLUT</b>
524 <p>GLUT implements these functions.
526 10.0 <a NAME="Menu"></a> Menu Functions</h1>
529 10.1 glutCreateMenu</h2>
532 10.2 glutDestroyMenu</h2>
535 10.3 glutGetMenu, glutSetMenu</h2>
538 10.4 glutAddMenuEntry</h2>
541 10.5 glutAddSubMenu</h2>
544 10.6 glutChangeToMenuEntry</h2>
547 10.7 glutChangeToSubMenu</h2>
550 10.8 glutRemoveMenuItem</h2>
553 10.9 glutAttachMenu, glutDetachMenu</h2>
556 11.0 <a NAME="GlobalCallback"></a> Global Callback Registration Functions</h1>
559 11.1 glutTimerFunc</h2>
562 11.2 glutIdleFunc</h2>
563 The "<tt>glutIdleFunc</tt>" function sets the global idle callback. <i>Freeglut</i>
564 calls the idle callback when there are no inputs from the user.
566 <p><tt>void glutIdleFunc ( void (*func) ( void ) ) ;</tt>
567 <p><tt>func </tt>The new global idle callback function
568 <p><b>Description</b>
569 <p>The "<tt>glutIdleFunc</tt>" function specifies the function that
571 will call to perform background processing tasks such as continuous animation
572 when window system events are not being received. If enabled, this
573 function is called continuously from <i>freeglut</i> while no events are
574 received. The callback function has no parameters and returns no
575 value. <i>Freeglut</i> does not change the <i>current window</i>
576 or the <i>current menu</i> before invoking the idle callback; programs
577 with multiple windows or menus must explicitly set the <i>current window</i>
578 and <i>current menu</i> and not rely on its current setting.
579 <br> The amount of computation and rendering done in
580 an idle callback should be minimized to avoid affecting the program's interactive
581 response. In general, no more than a single frame of rendering should
582 be done in a single invocation of an idle callback.
583 <br> Calling "<tt>glutIdleFunc</tt>" with a NULL argument
584 disables the call to an idle callback.
585 <p><b>Changes From GLUT</b>
586 <p>Application programmers should note that if they have specified the
587 "continue execution" action on window closure, <i>freeglut</i> will continue
588 to call the idle callback after the user has closed a window by clicking
589 on the "x" in the window header bar. If the idle callback renders
590 a particular window (this is considered bad form but is frequently done
591 anyway), the programmer should supply a window closure callback for that
592 window which changes or disables the idle callback.
594 12.0 <a NAME="WindowCallback"></a> Window-Specific Callback Registration
598 12.1 glutDisplayFunc</h2>
601 12.2 glutOverlayDisplayFunc</h2>
604 12.3 glutReshapeFunc</h2>
607 12.4 glutCloseFunc</h2>
610 12.5 glutKeyboardFunc</h2>
613 12.6 glutSpecialFunc</h2>
614 The "<tt>glutSpecialFunc</tt>" function sets the window's special key press
615 callback. <i>Freeglut</i> calls the special key press callback when the
616 user presses a special key.
618 <p><tt>void glutSpecialFunc ( void (*func) ( int key, int x, int y ) )
620 <p><tt>func </tt>The window's new special key press callback
622 <br><tt>key </tt>The key whose press triggers the
624 <br><tt>x </tt>The x-coordinate of
625 the mouse relative to the window at the time the key is pressed
626 <br><tt>y </tt>The y-coordinate of
627 the mouse relative to the window at the time the key is pressed
628 <p><b>Description</b>
629 <p>The "<tt>glutSpecialFunc</tt>" function specifies the function
630 that <i>freeglut</i> will call when the user presses a special key on the
631 keyboard. The callback function has one argument: the name
632 of the function to be invoked ("called back") at the time at which the
633 special key is pressed. The function returns no value. <i>Freeglut</i>
634 sets the <i>current window</i> to the window which is active when the callback
635 is invoked. "Special keys" are the function keys, the arrow keys,
636 the Page Up and Page Down keys, and the Insert key. The Delete key
637 is considered to be a regular key.
638 <br> Calling "<tt>glutSpecialUpFunc</tt>" with a NULL
639 argument disables the call to the window's special key press callback.
640 <p> The "<tt>key</tt>" argument may take one of the following
641 defined constant values:
644 <tt>GLUT_KEY_F1, GLUT_KEY_F2, ..., GLUT_KEY_F12</tt>
645 - F1 through F12 keys</li>
648 <tt>GLUT_KEY_PAGE_UP, GLUT_KEY_PAGE_DOWN</tt>
649 - Page Up and Page Down keys</li>
652 <tt>GLUT_KEY_HOME, GLUT_KEY_END</tt>
653 - Home and End keys</li>
656 <tt>GLUT_KEY_LEFT, GLUT_KEY_RIGHT, GLUT_KEY_UP, GLUT_KEY_DOWN</tt> - arrow
660 <tt>GLUT_KEY_INSERT</tt>
663 <b>Changes From GLUT</b>
666 12.7 glutKeyboardUpFunc</h2>
667 The "<tt>glutKeyboardUpFunc</tt>" function sets the window's key release
668 callback. <i>Freeglut</i> calls the key release callback when the user
671 <p><tt>void glutKeyboardUpFunc ( void (*func) ( unsigned char key, int
673 <p><tt>func </tt>The window's new key release callback
675 <br><tt>key </tt>The key whose release triggers
677 <br><tt>x </tt>The x-coordinate of
678 the mouse relative to the window at the time the key is released
679 <br><tt>y </tt>The y-coordinate of
680 the mouse relative to the window at the time the key is released
681 <p><b>Description</b>
682 <p>The "<tt>glutKeyboardUpFunc</tt>" function specifies the function
683 that <i>freeglut</i> will call when the user releases a key from the keyboard.
684 The callback function has one argument: the name of the function
685 to be invoked ("called back") at the time at which the key is released.
686 The function returns no value. <i>Freeglut</i> sets the <i>current
687 window</i> to the window which is active when the callback is invoked.
688 <br> While <i>freeglut</i> checks for upper or lower
689 case letters, it does not do so for non-alphabetical characters.
690 Nor does it account for the Caps-Lock key being on. The operating
691 system may send some unexpected characters to <i>freeglut</i>, such as
692 "8" when the user is pressing the Shift key. <i>Freeglut</i> also
693 invokes the callback when the user releases the Control, Alt, or Shift
694 keys, among others. Releasing the Delete key causes this function
695 to be invoked with a value of 127 for "<tt>key</tt>".
696 <br> Calling "<tt>glutKeyboardUpFunc</tt>" with a NULL
697 argument disables the call to the window's key release callback.
698 <p><b>Changes From GLUT</b>
699 <p>This function is not implemented in GLUT versions before Version 4.
700 It has been designed to be as close to GLUT as possible. Users who
701 find differences should contact the <i>freeglut</i> development team to
704 12.8 glutSpecialUpFunc</h2>
705 The "<tt>glutSpecialUpFunc</tt>" function sets the window's special key
706 release callback. <i>Freeglut</i> calls the special key release callback
707 when the user releases a special key.
709 <p><tt>void glutSpecialUpFunc ( void (*func) ( int key, int x, int y )
711 <p><tt>func </tt>The window's new special key release
713 <br><tt>key </tt>The key whose release triggers
715 <br><tt>x </tt>The x-coordinate of
716 the mouse relative to the window at the time the key is released
717 <br><tt>y </tt>The y-coordinate of
718 the mouse relative to the window at the time the key is released
719 <p><b>Description</b>
720 <p>The "<tt>glutSpecialUpFunc</tt>" function specifies the function
721 that <i>freeglut</i> will call when the user releases a special key from
722 the keyboard. The callback function has one argument: the name
723 of the function to be invoked ("called back") at the time at which the
724 special key is released. The function returns no value. <i>Freeglut</i>
725 sets the <i>current window</i> to the window which is active when the callback
726 is invoked. "Special keys" are the function keys, the arrow keys,
727 the Page Up and Page Down keys, and the Insert key. The Delete key
728 is considered to be a regular key.
729 <br> Calling "<tt>glutSpecialUpFunc</tt>" with a NULL
730 argument disables the call to the window's special key release callback.
731 <p> The "<tt>key</tt>" argument may take one of the following
732 defined constant values:
735 <tt>GLUT_KEY_F1, GLUT_KEY_F2, ..., GLUT_KEY_F12</tt>
736 - F1 through F12 keys</li>
739 <tt>GLUT_KEY_PAGE_UP, GLUT_KEY_PAGE_DOWN</tt>
740 - Page Up and Page Down keys</li>
743 <tt>GLUT_KEY_HOME, GLUT_KEY_END</tt>
744 - Home and End keys</li>
747 <tt>GLUT_KEY_LEFT, GLUT_KEY_RIGHT, GLUT_KEY_UP, GLUT_KEY_DOWN</tt> - arrow
751 <tt>GLUT_KEY_INSERT</tt>
754 <b>Changes From GLUT</b>
755 <p>This function is not implemented in GLUT versions before Version 4.
756 It has been designed to be as close to GLUT as possible. Users who
757 find differences should contact the <i>freeglut</i> development team to
760 12.9 glutMouseFunc</h2>
763 12.10 glutMotionFunc, glutPassiveMotionFunc</h2>
766 12.11 glutVisibilityFunc</h2>
769 12.12 glutEntryFunc</h2>
772 12.13 glutJoystickFunc</h2>
775 12.14 glutSpaceballMotionFunc</h2>
778 12.15 glutSpaceballRotateFunc</h2>
781 12.16 glutSpaceballButtonFunc</h2>
784 12.17 glutButtonBoxFunc</h2>
787 12.18 glutDialsFunc</h2>
790 12.19 glutTabletMotionFunc</h2>
793 12.20 glutTabletButtonFunc</h2>
796 12.21 glutMenuStatusFunc</h2>
799 12.22 glutWindowStatusFunc</h2>
802 13.0 <a NAME="StateSetting"></a> State Setting and Retrieval Functions</h1>
805 13.1 glutSetOption</h2>
808 13.2 glutGet</h2>
811 The following state variables may be queried with glutGet.
812 The returned value is an integer.
816 These queries are with respect to the current window:
820 <li>GLUT_WINDOW_X - window X position
821 <li>GLUT_WINDOW_Y - window Y position
822 <li>GLUT_WINDOW_WIDTH - window width
823 <li>GLUT_WINDOW_HEIGHT - window height
824 <li>GLUT_WINDOW_BUFFER_SIZE - number of color or color index bits per pixel
825 <li>GLUT_WINDOW_STENCIL_SIZE - number of bits per stencil value
826 <li>GLUT_WINDOW_DEPTH_SIZE - number of bits per depth value
827 <li>GLUT_WINDOW_RED_SIZE - number of bits per red value
828 <li>GLUT_WINDOW_GREEN_SIZE - number of bits per green value
829 <li>GLUT_WINDOW_BLUE_SIZE - number of bits per blue value
830 <li>GLUT_WINDOW_ALPHA_SIZE - number of bits per alpha value
831 <li>GLUT_WINDOW_ACCUM_RED_SIZE - number of red bits in the accumulation buffer
832 <li>GLUT_WINDOW_ACCUM_GREEN_SIZE - number of green bits in the accumulation buffer
833 <li>GLUT_WINDOW_ACCUM_BLUE_SIZE - number of blue bits in the accumulation buffer
834 <li>GLUT_WINDOW_ACCUM_ALPHA_SIZE - number of alpha bits in the accumulation buffer
835 <li>GLUT_WINDOW_DOUBLEBUFFER - 1 if the color buffer is double buffered, 0 otherwise
836 <li>GLUT_WINDOW_RGBA - 1 if the color buffers are RGB[A], 0 for color index
837 <li>GLUT_WINDOW_PARENT - parent window ID
838 <li>GLUT_WINDOW_NUM_CHILDREN - number of child windows
839 <li>GLUT_WINDOW_COLORMAP_SIZE - number of entries in the window's colormap
840 <li>GLUT_WINDOW_NUM_SAMPLES - number of samples per pixel if using multisampling
841 <li>GLUT_WINDOW_STEREO - 1 if the window supports stereo, 0 otherwise
842 <li>GLUT_WINDOW_CURSOR - current cursor
843 <li>GLUT_WINDOW_FORMAT_ID - on Windows, return the pixel format number of the current window
847 These queries do not depend on the current window.
851 <li>GLUT_SCREEN_WIDTH - width of the screen in pixels
852 <li>GLUT_SCREEN_HEIGHT - height of the screen in pixels
853 <li>GLUT_SCREEN_WIDTH_MM - width of the screen in millimeters
854 <li>GLUT_SCREEN_HEIGHT_MM - height of the screen in millimeters
855 <li>GLUT_MENU_NUM_ITEMS - number of items in the current menu
856 <li>GLUT_DISPLAY_MODE_POSSIBLE - return 1 if the current display mode is supported, 0 otherwise
857 <li>GLUT_INIT_WINDOW_X - X position last set by glutInitWindowPosition
858 <li>GLUT_INIT_WINDOW_Y - Y position last set by glutInitWindowPosition
859 <li>GLUT_INIT_WINDOW_WIDTH - width last set by glutInitWindowSize
860 <li>GLUT_INIT_WINDOW_HEIGHT - height last set by glutInitWindowSize
861 <li>GLUT_INIT_DISPLAY_MODE - display mode last set by glutInitDisplayMode
862 <li>GLUT_ELAPSED_TIME - time (in milliseconds) elapsed since glutInit or glutGet(GLUT_ELAPSED_TIME) was first called
863 <li>GLUT_INIT_STATE - ?
864 <li>GLUT_VERSION - Return value will be X*10000+Y*100+Z where X is the
865 major version, Y is the minor version and Z is the patch level.
866 This query is only supported in FreeGLUT (version 1.3 or later).
872 13.3 glutDeviceGet</h2>
875 13.4 glutGetModifiers</h2>
878 13.5 glutLayerGet</h2>
881 13.6 glutExtensionSupported</h2>
884 13.7 glutGetProcAddress</h2>
886 <tt>glutGetProcAddress</tt> returns a pointer to a named GL or FreeGLUT function.
889 <p><tt>void *glutGetProcAddress ( const char *procName ) ;</tt>
890 <p><tt>procName </tt>Name of
891 an OpenGL or GLUT function.
893 <p><b>Description</b>
894 <p><tt>glutGetProcAddress</tt> is useful for dealing with OpenGL extensions.
895 If an application calls OpenGL extension functions directly, that application
896 will only link/run with an OpenGL library that supports the extension.
897 By using a function pointer returned from glutGetProcAddress(), the
898 application will avoid this hard dependency and be more portable and
899 interoperate better with various implementations of OpenGL.
902 Both OpenGL functions and FreeGLUT functions can be queried with this function.
903 Since WGL returns context-dependent function pointers, glutGetProcAddress
904 should be queried per FreeGLUT window.
907 <b>NOTE</b>: this function is not supported in GLUT.
913 14.0 <a NAME="FontRendering"></a> Font Rendering Functions</h1>
914 <i>Freeglut</i> supports two types of font rendering: bitmap fonts,
915 which are rendered using the "<tt>glBitmap</tt>" function call, and stroke
916 fonts, which are rendered as sequences of OpenGL line segments. Because
917 they are rendered as bitmaps, the bitmap fonts tend to render more quickly
918 than stroke fonts, but they are less flexible in terms of scaling and rendering.
919 Bitmap font characters are positioned with calls to the "<tt>glRasterPos*</tt>
920 " functions while stroke font characters use the OpenGL transformations
921 to position characters.
922 <p> It should be noted that <i>freeglut</i> fonts are
923 similar but not identical to GLUT fonts. At the moment, <i>freeglut</i>
924 fonts do not support the "`" (backquote) and "|" (vertical line) characters;
925 in their place it renders asterisks.
926 <p> <i>Freeglut</i> supports the following bitmap fonts:
929 <tt>GLUT_BITMAP_8_BY_13</tt> - A variable-width font with every character
930 fitting in a rectangle of 13 pixels high by at most 8 pixels wide.</li>
933 <tt>GLUT_BITMAP_9_BY_15</tt> - A variable-width font with every character
934 fitting in a rectangle of 15 pixels high by at most 9 pixels wide.</li>
937 <tt>GLUT_BITMAP_TIMES_ROMAN_10</tt> - A 10-point variable-width Times Roman
941 <tt>GLUT_BITMAP_TIMES_ROMAN_24</tt> - A 24-point variable-width Times Roman
945 <tt>GLUT_BITMAP_HELVETICA_10</tt> - A 10-point variable-width Helvetica
949 <tt>GLUT_BITMAP_HELVETICA_12</tt> - A 12-point variable-width Helvetica
953 <tt>GLUT_BITMAP_HELVETICA_18</tt> - A 18-point variable-width Helvetica
956 <i>Freeglut</i> calls "<tt>glRasterPos4v</tt>" to advance the cursor by
957 the width of a character and to render carriage returns when appropriate.
958 It does not use any display lists in it rendering in bitmap fonts.
959 <p> <i>Freeglut</i> supports the following stroke fonts:
962 <tt>GLUT_STROKE_ROMAN</tt> - A proportionally-spaced Roman Simplex font</li>
965 <tt>GLUT_STROKE_MONO_ROMAN</tt> - A fixed-width Roman Simplex font</li>
967 <i>Freeglut</i> does not use any display lists in its rendering of stroke
968 fonts. It calls "<tt>glTranslatef</tt>" to advance the cursor by
969 the width of a character and to render carriage returns when appropriate.
971 14.1 glutBitmapCharacter</h2>
972 The "<tt>glutBitmapCharacter</tt>" function renders a single bitmapped
973 character in the <i>current window</i> using the specified font.
975 <p><tt>void glutBitmapCharacter ( void *font, int character ) ;</tt>
976 <p><tt>font </tt>The bitmapped
977 font to use in rendering the character
978 <br><tt>character </tt>The ASCII code of the character to be
980 <p><b>Description</b>
981 <p>The "<tt>glutBitmapCharacter</tt> " function renders the given
982 character in the specified bitmap font. <i>Freeglut</i> automatically
983 sets the necessary pixel unpack storage modes and restores the existing
984 modes when it has finished. Before the first call to "<tt>glutBitMapCharacter</tt>
985 " the application program should call "<tt>glRasterPos*</tt>" to set the
986 position of the character in the window. The "<tt>glutBitmapCharacter</tt>"
987 function advances the cursor position as part of its call to "<tt>glBitmap</tt>"
988 and so the application does not need to call "<tt>glRasterPos*</tt>" again
989 for successive characters on the same line.
990 <p><b>Changes From GLUT</b>
991 <p>Nonexistent characters are rendered as asterisks. The rendering
992 position in <i>freeglut</i> is apparently off from GLUT's position by a
993 few pixels vertically and one or two pixels horizontally.
995 14.2 glutBitmapString</h2>
996 The "<tt>glutBitmapString</tt>" function renders a string of bitmapped
997 characters in the <i>current window</i> using the specified font.
999 <p><tt>void glutBitmapString ( void *font, char *string ) ;</tt>
1000 <p><tt>font </tt>The bitmapped font to use
1001 in rendering the character string
1002 <br><tt>string </tt>String of characters to be rendered
1003 <p><b>Description</b>
1004 <p>The "<tt>glutBitmapString</tt> " function renders the given character
1005 string in the specified bitmap font. <i>Freeglut</i> automatically
1006 sets the necessary pixel unpack storage modes and restores the existing
1007 modes when it has finished. Before calling "<tt>glutBitMapString</tt>"
1008 the application program should call "<tt>glRasterPos*</tt>" to set the
1009 position of the string in the window. The "<tt>glutBitmapString</tt>"
1010 function handles carriage returns. Nonexistent characters are rendered
1012 <p><b>Changes From GLUT</b>
1013 <p>GLUT does not include this function.
1015 14.3 glutBitmapWidth</h2>
1016 The "<tt>glutBitmapWidth</tt>" function returns the width in pixels of
1017 a single bitmapped character in the specified font.
1019 <p><tt>int glutBitmapWidth ( void *font, int character ) ;</tt>
1020 <p><tt>font </tt>The bitmapped
1021 font to use in calculating the character width
1022 <br><tt>character </tt>The ASCII code of the character
1023 <p><b>Description</b>
1024 <p>The "<tt>glutBitmapWidth</tt>" function returns the width of the
1025 given character in the specified bitmap font. Because the font is
1026 bitmapped, the width is an exact integer.
1027 <p><b>Changes From GLUT</b>
1028 <p>Nonexistent characters return the width of an asterisk.
1030 14.4 glutBitmapLength</h2>
1031 The "<tt>glutBitmapLength</tt>" function returns the width in pixels of
1032 a string of bitmapped characters in the specified font.
1034 <p><tt>int glutBitmapLength ( void *font, char *string ) ;</tt>
1035 <p><tt>font </tt>The bitmapped font to use in calculating
1037 <br><tt>string </tt>String of characters whose width is to be calculated
1038 <p><b>Description</b>
1039 <p>The "<tt>glutBitmapLength</tt> " function returns the width in
1040 pixels of the given character string in the specified bitmap font.
1041 Because the font is bitmapped, the width is an exact integer: the
1042 return value is identical to the sum of the character widths returned by
1043 a series of calls to "<tt>glutBitmapWidth</tt>". The width of nonexistent
1044 characters is counted to be the width of an asterisk.
1045 <p> If the string contains one or more carriage returns,
1047 calculates the widths in pixels of the lines separately and returns the
1049 <p><b>Changes From GLUT</b>
1050 <p>GLUT does not include this function.
1052 14.5 glutBitmapHeight</h2>
1053 The "<tt>glutBitmapHeight</tt>" function returns the height in pixels of
1056 <p><tt>int glutBitmapHeight ( void *font ) ;</tt>
1057 <p><tt>font </tt>The bitmapped
1058 font to use in calculating the character height
1059 <p><b>Description</b>
1060 <p>The "<tt>glutBitmapHeight</tt> " function returns the height of
1061 a character in the specified bitmap font. Because the font is bitmapped,
1062 the height is an exact integer. The fonts are designed such that
1063 all characters have (nominally) the same height.
1064 <p><b>Changes From GLUT</b>
1065 <p>GLUT does not include this function.
1067 14.6 glutStrokeCharacter</h2>
1068 The "<tt>glutStrokeCharacter</tt>" function renders a single stroke character
1069 in the <i>current window</i> using the specified font.
1071 <p><tt>void glutStrokeCharacter ( void *font, int character ) ;</tt>
1072 <p><tt>font </tt>The stroke font
1073 to use in rendering the character
1074 <br><tt>character </tt>The ASCII code of the character to be
1076 <p><b>Description</b>
1077 <p>The "<tt>glutStrokeCharacter</tt> " function renders the given
1078 character in the specified stroke font. Before the first call to
1079 "<tt>glutStrokeCharacter</tt>" the application program should call the
1080 OpenGL transformation (positioning and scaling) functions to set the position
1081 of the character in the window. The "<tt>glutStrokeCharacter</tt>
1082 " function advances the cursor position by a call to "<tt>glTranslatef</tt>
1083 " and so the application does not need to call the OpenGL positioning functions
1084 again for successive characters on the same line.
1085 <p><b>Changes From GLUT</b>
1086 <p>Nonexistent characters are rendered as asterisks.
1088 14.7 glutStrokeString</h2>
1089 The "<tt>glutStrokeString</tt>" function renders a string of characters
1090 in the <i>current window</i> using the specified stroke font.
1092 <p><tt>void glutStrokeString ( void *font, char *string ) ;</tt>
1093 <p><tt>font </tt>The stroke font to use in
1094 rendering the character string
1095 <br><tt>string </tt>String of characters to be rendered
1096 <p><b>Description</b>
1097 <p>The "<tt>glutStrokeString</tt> " function renders the given character
1098 string in the specified stroke font. Before calling "<tt>glutStrokeString</tt>"
1099 the application program should call the OpenGL transformation (positioning
1100 and scaling) functions to set the position of the string in the window.
1101 The "<tt>glutStrokeString</tt> " function handles carriage returns.
1102 Nonexistent characters are rendered as asterisks.
1103 <p><b>Changes From GLUT</b>
1104 <p>GLUT does not include this function.
1106 14.8 glutStrokeWidth</h2>
1107 The "<tt>glutStrokeWidth</tt>" function returns the width in pixels of
1108 a single character in the specified stroke font.
1110 <p><tt>int glutStrokeWidth ( void *font, int character ) ;</tt>
1111 <p><tt>font </tt>The stroke font
1112 to use in calculating the character width
1113 <br><tt>character </tt>The ASCII code of the character
1114 <p><b>Description</b>
1115 <p>The "<tt>glutStrokeWidth</tt>" function returns the width of the
1116 given character in the specified stroke font. Because the font is
1117 a stroke font, the width is actually a floating-point number; the function
1118 rounds it to the nearest integer for the return value.
1119 <p><b>Changes From GLUT</b>
1120 <p>Nonexistent characters return the width of an asterisk.
1122 14.9 glutStrokeLength</h2>
1123 The "<tt>glutStrokeLength</tt>" function returns the width in pixels of
1124 a string of characters in the specified stroke font.
1126 <p><tt>int glutStrokeLength ( void *font, char *string ) ;</tt>
1127 <p><tt>font </tt>The stroke font to use in calculating
1129 <br><tt>string </tt>String of characters whose width is to be calculated
1130 <p><b>Description</b>
1131 <p>The "<tt>glutStrokeLength</tt> " function returns the width in
1132 pixels of the given character string in the specified stroke font.
1133 Because the font is a stroke font, the width of an individual character
1134 is a floating-point number. <i>Freeglut</i> adds the floating-point
1135 widths and rounds the funal result to return the integer value. Thus
1136 the return value may differ from the sum of the character widths returned
1137 by a series of calls to "<tt>glutStrokeWidth</tt> ". The width of
1138 nonexistent characters is counted to be the width of an asterisk.
1139 <p> If the string contains one or more carriage returns,
1141 calculates the widths in pixels of the lines separately and returns the
1143 <p><b>Changes From GLUT</b>
1144 <p>GLUT does not include this function.
1146 14.10 glutStrokeHeight</h2>
1147 The "<tt>glutStrokeHeight</tt>" function returns the height in pixels of
1150 <p><tt>GLfloat glutStrokeHeight ( void *font ) ;</tt>
1151 <p><tt>font </tt>The stroke font
1152 to use in calculating the character height
1153 <p><b>Description</b>
1154 <p>The "<tt>glutStrokeHeight</tt> " function returns the height of
1155 a character in the specified stroke font. The application programmer
1156 should note that, unlike the other <i>freeglut</i> font functions, this
1157 one returns a floating-point number. The fonts are designed such
1158 that all characters have (nominally) the same height.
1159 <p><b>Changes From GLUT</b>
1160 <p>GLUT does not include this function.
1162 15.0 <a NAME="GeometricObject"></a> Geometric Object Rendering Functions</h1>
1163 <i>Freeglut</i> includes eighteen routines for generating easily-recognizable
1164 3-d geometric objects. These routines are effectively the same ones
1165 that are included in the GLUT library, and reflect the functionality available
1166 in the <i>aux</i> toolkit described in the <i>OpenGL Programmer's Guide</i>
1167 . They are included to allow programmers to create with a single
1168 line of code a three-dimensional object which can be used to test a variety
1169 of OpenGL functionality. None of the routines generates a display
1170 list for the object which it draws. The functions generate normals
1171 appropriate for lighting but, except for the teapon functions, do not generate
1172 texture coordinates.
1174 15.1 glutWireSphere, glutSolidSphere</h2>
1175 The "<tt>glutWireSphere</tt>" and "<tt>glutSolidSphere</tt>" functions
1176 draw a wireframe and solid sphere respectively.
1178 <p><tt>void glutWireSphere ( GLdouble dRadius, GLint slices, GLint stacks
1180 <p><tt>void glutSolidSphere ( GLdouble dRadius, GLint slices, GLint stacks
1182 <p><tt>dRadius </tt>The desired radius
1184 <p><tt>slices </tt>The desired
1185 number of slices (divisions in the longitudinal direction) in the sphere
1186 <p><tt>stacks </tt>The desired
1187 number of stacks (divisions in the latitudinal direction) in the sphere.
1188 The number of points in this direction, including the north and south poles,
1189 is <tt>stacks+1</tt>
1190 <p><b>Description</b>
1191 <p>The "<tt>glutWireSphere</tt>" and "<tt> glutSolidSphere</tt>" functions
1192 render a sphere centered at the origin of the modeling coordinate system.
1193 The north and south poles of the sphere are on the positive and negative
1194 Z-axes respectively and the prime meridian crosses the positive X-axis.
1195 <p><b>Changes From GLUT</b>
1196 <p>None that we know of.
1198 15.2 glutWireTorus, glutSolidTorus</h2>
1199 The "<tt>glutWireTorus</tt>" and "<tt>glutSolidTorus</tt>" functions draw
1200 a wireframe and solid torus (donut shape) respectively.
1202 <p><tt>void glutWireTorus ( GLdouble dInnerRadius, GLdouble dOuterRadius,
1203 GLint nSides, GLint nRings ) ;</tt>
1204 <p><tt>void glutSolidTorus ( GLdouble dInnerRadius, GLdouble dOuterRadius,
1205 GLint nSides, GLint nRings ) ;</tt>
1206 <p><tt>dInnerRadius </tt>The
1207 desired inner radius of the torus, from the origin to the circle defining
1208 the centers of the outer circles
1209 <p><tt>dOuterRadius </tt>The
1210 desired outer radius of the torus, from the center of the outer circle
1211 to the actual surface of the torus
1212 <p><tt>nSides </tt>The desired
1213 number of segments in a single outer circle of the torus
1214 <p><tt>nRings </tt>The desired
1215 number of outer circles around the origin of the torus
1216 <p><b>Description</b>
1217 <p>The "<tt>glutWireTorus</tt>" and "<tt> glutSolidTorus</tt>" functions
1218 render a torus centered at the origin of the modeling coordinate system.
1219 The torus is circularly symmetric about the Z-axis and starts at the positive
1221 <p><b>Changes From GLUT</b>
1222 <p>None that we know of.
1224 15.3 glutWireCone, glutSolidCone</h2>
1225 The "<tt>glutWireCone</tt>" and "<tt>glutSolidCone</tt>" functions draw
1226 a wireframe and solid cone respectively.
1228 <p><tt>void glutWireCone ( GLdouble base, GLdouble height, GLint slices,
1229 GLint stacks ) ;</tt>
1230 <p><tt>void glutSolidCone ( GLdouble base, GLdouble height, GLint slices,
1231 GLint stacks ) ;</tt>
1232 <p><tt>base </tt>The
1233 desired radius of the base of the cone
1234 <p><tt>height </tt>The desired
1236 <p><tt>slices </tt>The desired
1237 number of slices around the base of the cone
1238 <p><tt>stacks </tt>The desired
1239 number of segments between the base and the tip of the cone (the number
1240 of points, including the tip, is <tt>stacks + 1</tt>)
1241 <p><b>Description</b>
1242 <p>The "<tt>glutWireCone</tt>" and "<tt> glutSolidCone</tt>" functions
1243 render a right circular cone with a base centered at the origin and in
1244 the X-Y plane and its tip on the positive Z-axis. The wire cone is
1245 rendered with triangular elements.
1246 <p><b>Changes From GLUT</b>
1247 <p>None that we know of.
1249 15.4 glutWireCube, glutSolidCube</h2>
1250 The "<tt>glutWireCube</tt>" and "<tt>glutSolidCube</tt>" functions draw
1251 a wireframe and solid cube respectively.
1253 <p><tt>void glutWireCube ( GLdouble dSize ) ;</tt>
1254 <p><tt>void glutSolidCube ( GLdouble dSize ) ;</tt>
1255 <p><tt>dSize </tt>The desired
1256 length of an edge of the cube
1257 <p><b>Description</b>
1258 <p>The "<tt>glutWireCube</tt>" and "<tt> glutSolidCube</tt>" functions
1259 render a cube of the desired size, centered at the origin. Its faces
1260 are normal to the coordinate directions.
1261 <p><b>Changes From GLUT</b>
1262 <p>None that we know of.
1264 15.5 glutWireTetrahedron, glutSolidTetrahedron</h2>
1265 The "<tt>glutWireTetrahedron</tt>" and "<tt>glutSolidTetrahedron</tt>"
1266 functions draw a wireframe and solid tetrahedron (four-sided Platonic solid)
1269 <p><tt>void glutWireTetrahedron ( void ) ;</tt>
1270 <p><tt>void glutSolidTetrahedron ( void ) ;</tt>
1271 <p><b>Description</b>
1272 <p>The "<tt>glutWireTetrahedron</tt>" and "<tt>glutSolidTetrahedron</tt>"
1273 functions render a tetrahedron whose corners are each a distance of one
1274 from the origin. The length of each side is 2/3 sqrt(6). One
1275 corner is on the positive X-axis and another is in the X-Y plane with a
1276 positive Y-coordinate.
1277 <p><b>Changes From GLUT</b>
1278 <p>None that we know of.
1280 15.6 glutWireOctahedron, glutSolidOctahedron</h2>
1281 The "<tt>glutWireOctahedron</tt>" and "<tt>glutSolidOctahedron</tt>" functions
1282 draw a wireframe and solid octahedron (eight-sided Platonic solid) respectively.
1284 <p><tt>void glutWireOctahedron ( void ) ;</tt>
1285 <p><tt>void glutSolidOctahedron ( void ) ;</tt>
1286 <p><b>Description</b>
1287 <p>The "<tt>glutWireOctahedron</tt>" and "<tt>glutSolidOctahedron</tt>"
1288 functions render an octahedron whose corners are each a distance of one
1289 from the origin. The length of each side is sqrt(2). The corners
1290 are on the positive and negative coordinate axes.
1291 <p><b>Changes From GLUT</b>
1292 <p>None that we know of.
1294 15.7 glutWireDodecahedron, glutSolidDodecahedron</h2>
1295 The "<tt>glutWireDodecahedron</tt>" and "<tt>glutSolidDodecahedron</tt>"
1296 functions draw a wireframe and solid dodecahedron (twelve-sided Platonic
1297 solid) respectively.
1299 <p><tt>void glutWireDodecahedron ( void ) ;</tt>
1300 <p><tt>void glutSolidDodecahedron ( void ) ;</tt>
1301 <p><b>Description</b>
1302 <p>The "<tt>glutWireDodecahedron</tt>" and "<tt>glutSolidDodecahedron</tt>"
1303 functions render a dodecahedron whose corners are each a distance of sqrt(3)
1304 from the origin. The length of each side is sqrt(5)-1. There
1305 are twenty corners; interestingly enough, eight of them coincide with the
1306 corners of a cube with sizes of length 2.
1307 <p><b>Changes From GLUT</b>
1308 <p>None that we know of.
1310 15.8 glutWireIcosahedron, glutSolidIcosahedron</h2>
1311 The "<tt>glutWireIcosahedron</tt>" and "<tt>glutSolidIcosahedron</tt>"
1312 functions draw a wireframe and solid icosahedron (twenty-sided Platonic
1313 solid) respectively.
1315 <p><tt>void glutWireIcosahedron ( void ) ;</tt>
1316 <p><tt>void glutSolidIcosahedron ( void ) ;</tt>
1317 <p><b>Description</b>
1318 <p>The "<tt>glutWireIcosahedron</tt>" and "<tt>glutSolidIcosahedron</tt>"
1319 functions render an icosahedron whose corners are each a unit distance
1320 from the origin. The length of each side is slightly greater than
1321 one. Two of the corners lie on the positive and negative X-axes.
1322 <p><b>Changes From GLUT</b>
1323 <p>None that we know of.
1325 15.7 glutWireRhombicDodecahedron, glutSolidRhombicDodecahedron</h2>
1326 The "<tt>glutWireRhombicDodecahedron</tt>" and "<tt>glutSolidRhombicDodecahedron</tt>
1327 " functions draw a wireframe and solid rhombic dodecahedron (twelve-sided
1328 semi-regular solid) respectively.
1330 <p><tt>void glutWireRhombicDodecahedron ( void ) ;</tt>
1331 <p><tt>void glutSolidRhombicDodecahedron ( void ) ;</tt>
1332 <p><b>Description</b>
1333 <p>The "<tt>glutWireRhombicDodecahedron</tt> " and "<tt>glutSolidRhombicDodecahedron</tt>"
1334 functions render a rhombic dodecahedron whose corners are at most a distance
1335 of one from the origin. The rhombic dodecahedron has faces which
1336 are identical rhombuses (rhombi?) but which have some vertices at which
1337 three faces meet and some vertices at which four faces meet. The
1338 length of each side is sqrt(3)/2. Vertices at which four faces meet
1339 are found at (0, 0, <u>+</u>1) and (<u> +</u>sqrt(2)/2, <u>+</u>sqrt(2)/2,
1341 <p><b>Changes From GLUT</b>
1342 <p>GLUT does not include these functions.
1344 15.10 glutWireTeapot, glutSolidTeapot</h2>
1345 The "<tt>glutWireTeapot</tt>" and "<tt>glutSolidTeapot</tt>" functions
1346 draw a wireframe and solid teapot respectively.
1348 <p><tt>void glutWireTeapot ( GLdouble dSize ) ;</tt>
1349 <p><tt>void glutSolidTeapot ( GLdouble dSize ) ;</tt>
1350 <p><tt>dSize </tt>The desired
1352 <p><b>Description</b>
1353 <p>The "<tt>glutWireTeapot</tt>" and "<tt> glutSolidTeapot</tt>" functions
1354 render a teapot of the desired size, centered at the origin. This
1355 is the famous OpenGL teapot [add reference].
1356 <p><b>Changes From GLUT</b>
1357 <p>None that we know of.
1359 16.0 <a NAME="GameMode"></a> Game Mode Functions</h1>
1362 16.1 glutGameModeString</h2>
1365 16.2 glutEnterGameMode, glutLeaveGameMode</h2>
1368 16.3 glutGameModeGet</h2>
1371 17.0 <a NAME="VideoResize"></a> Video Resize Functions</h1>
1374 17.1 glutVideoResizeGet</h2>
1377 17.2 glutSetupVideoResizing, glutStopVideoResizing</h2>
1380 17.3 glutVideoResize</h2>
1383 17.4 glutVideoPan</h2>
1386 18.0 <a NAME="ColorMap"></a> Color Map Functions</h1>
1389 18.1 glutSetColor, glutGetColor</h2>
1392 18.2 glutCopyColormap</h2>
1395 19.0 <a NAME="Miscellaneous"></a> Miscellaneous Functions</h1>
1398 19.1 glutIgnoreKeyRepeat, glutSetKeyRepeat</h2>
1401 19.2 glutForceJoystickFunc</h2>
1404 19.3 glutReportErrors</h2>
1407 20.0 <a NAME="UsageNotes"></a> Usage Notes</h1>
1410 The following environment variables are recognized by FreeGLUT:
1413 <li>GLUT_FPS - specifies a time interval (in milliseconds) for
1414 reporting framerate messages to stderr. For example, if FREEGLUT_FPS
1415 is set to 5000, every 5 seconds a message will be printed to stderr
1416 showing the current frame rate. The frame rate is measured by
1417 counting the number of times glutSwapBuffers() is called over the time
1423 21.0 <a NAME="ImplementationNotes"></a> Implementation Notes</h1>
1426 22.0 <a NAME="GLUT_State"></a> GLUT State</h1>
1429 23.0 <a NAME="Freeglut.h_Header"></a> "freeglut.h" Header File</h1>
1432 FreeGLUT users should normally just include GL/glut.h in their programs.
1433 Programs which need FreeGLUT-specific functions should also include
1434 GL/freeglut_ext.h as follows:
1438 #include <GL/glut.h>
1440 #include <GL/freeglut_ext.h>
1445 Compile-time FreeGLUT version testing can be done as follows:
1449 #ifdef FREEGLUT_VERSION_1_3
1450 code specific to FreeGLUT 1.3 or later here
1455 In future releases, FREEGLUT_VERSION_1_4, FREEGLUT_VERSION_1_5, etc will
1456 be defined. This scheme mimics OpenGL conventions.
1460 The FreeGLUT version can be queried at runtime by calling
1461 glutGet(GLUT_VERSION).
1462 The result will be X*10000+Y*100+Z where X is the major version, Y is the
1463 minor version and Z is the patch level.
1466 This may be used as follows:
1470 if (glutGet(GLUT_VERSION) < 10300) {
1471 printf("Sorry, you need FreeGLUT version 1.3.0 or later to run this program.\n");
1478 24.0 <a NAME="References"></a> References</h1>
1481 25.0 <a NAME="Index"></a> Index</h1>