1UNTITLED LOCAL UNTITLED
2
4 glutInit — Initialize OpenGLUT data structures.
5
7 OpenGLUT - mainloop
8
10 #include <openglut.h>
11
12 void
13 glutInit(int *pargc, char **argv);
14
16 pargc Pointer to something like main()'s argc.
17
18 argv Something like main()'s argv.
19
21 This function should be called once, near the start of any GLUT, freeg‐
22 lut, or OpenGLUT program. It serves two vital roles:
23
24 - It allows OpenGLUT to initialize internal structures.
25 - It allows OpenGLUT to process command-line arguments to control the
26 initial window position, etc.
27
28 You should take note of the interaction between glutInit() and the
29 related functions such as glutInitWindowPosition(). OpenGLUT always uses
30 the most recent configuration information, so if you call glutInit(),
31 then glutInitWindowPosition(), you prevent the user from controlling the
32 initial window position via a command-line parameter.
33
34 glutInit() will remove from pargc, argv any parameters that it recog‐
35 nizes in the command line. The following command-line parameters are
36 suported:
37
38 - -display display-id This allows connection to an alternate X
39 server.
40 - -geometry geometry-spec This takes width, height, and window posi‐
41 tion. The position is given as a signed value (negative values being
42 distance from the far boundary of the screen). For example, a window
43 geometry of 5x7+11-17 is 5 pixels wide, 7 pixels tall, 11 pixels from the
44 left, and 17 pixels from the bottom edge of the screen.
45 - -direct Insist on only OpenGL direct rendering. Direct rendering is
46 normally requested but indirect is normally accepted. -direct is not
47 always available. See -indirect.
48 - -indirect Attempt only indirect OpenGL rendering. -indirect is
49 always available. See -direct.
50 - -iconic Open the window in iconized form.
51 - -gldebug Print any detected OpenGL errors via glutReportErrors().
52 Presently done at the bottom of glutMainLoopEvent().
53 - -sync Synchronize the window system communications heavily.
54
55 Additionally, this function checks whether the environment variable
56 GLUT_FPS is defined (only on UNIX_X11); if so, OpenGLUT will periodi‐
57 cally print the average number of times per second that your program
58 calls glutSwapBuffers().
59
61 You really should always call this, even if you are a WIN32 user. It
62 provides a way for the user to directly inform OpenGLUT about preferences
63 without the application needing to explicitly deal with those issues.
64 This is also where OpenGLUT retrieves your program's name to help disam‐
65 biguate error and warning messages it may be forced to emit.
66
67 Option -sync sets a flag, but is not actually used at this time.
68
69 Lots of code does XFlush() on the X server, regardless of whether -sync
70 is specified. Much of that appears to be required in order to support
71 direct client invocation of glutMainLoopEvent(), regrettably. However,
72 if one calls glutMainLoop(), instead, we might avoid gratuitous XFlush()
73 calls. (That last sentence isn't particularly germain to this function,
74 but there's no better place to make this remark at this time.) Even for
75 glutMainLoopEvent(), we may be able to coalesce many XFlush() calls.
76
78 glutInitWindowPosition(3) glutInitWindowSize(3) glutInitDisplayMode(3)
79 glutInitDisplayString(3) glutCreateWindow(3) glutDisplayFunc(3)
80 glutMainLoop(3) glutMainLoopEvent(3) glutReportErrors(3)
81 glutSwapBuffers(3)
82
83
84
85
86 Epoch