2 * DOS/DJGPP Mesa Utility Toolkit
5 * Copyright (C) 2005 Daniel Borca All Rights Reserved.
7 * Permission is hereby granted, free of charge, to any person obtaining a
8 * copy of this software and associated documentation files (the "Software"),
9 * to deal in the Software without restriction, including without limitation
10 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
11 * and/or sell copies of the Software, and to permit persons to whom the
12 * Software is furnished to do so, subject to the following conditions:
14 * The above copyright notice and this permission notice shall be included
15 * in all copies or substantial portions of the Software.
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
18 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20 * DANIEL BORCA BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
21 * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
34 char *__glutProgramName
= NULL
;
36 GLUTvisual _glut_visual
= {
37 16, 8, 16, 8, 16, /* bpp, alpha, depth, stencil, accum */
39 { 0, 0 }, 0, /* geometry */
44 GLUTdefault _glut_default
= {
45 0, 0, /* glutInitWindowPosition */
46 300, 300, /* glutInitWindowSize */
47 0 /* glutInitDisplayMode */
52 static char *init_string
;
56 _glut_fatal (char *format
,...)
60 va_start(args
, format
);
61 fprintf(stderr
, "GLUT: Fatal Error in %s: ",
62 __glutProgramName
? __glutProgramName
: "(unamed)");
63 vfprintf(stderr
, format
, args
);
70 /* strdup is actually not a standard ANSI C or POSIX routine
71 * so implement a private one for GLUT.
74 _glut_strdup (const char *string
)
77 int len
= strlen(string
) + 1;
78 char *p
= malloc(len
);
80 return strcpy(p
, string
);
88 glutInit (int *argc
, char **argv
)
93 if ((env
= getenv("DMESA_GLUT_BPP")) != NULL
) {
94 _glut_visual
.bpp
= atoi(env
);
96 if ((env
= getenv("DMESA_GLUT_ALPHA")) != NULL
) {
97 _glut_visual
.alpha
= atoi(env
);
99 if ((env
= getenv("DMESA_GLUT_DEPTH")) != NULL
) {
100 _glut_visual
.depth
= atoi(env
);
102 if ((env
= getenv("DMESA_GLUT_STENCIL")) != NULL
) {
103 _glut_visual
.stencil
= atoi(env
);
105 if ((env
= getenv("DMESA_GLUT_ACCUM")) != NULL
) {
106 _glut_visual
.accum
= atoi(env
);
108 if ((env
= getenv("DMESA_GLUT_REFRESH")) != NULL
) {
109 _glut_visual
.refresh
= atoi(env
);
112 /* Determine program name. */
113 str
= strrchr(argv
[0], '/');
119 __glutProgramName
= _glut_strdup(str
);
121 /* check if GLUT_FPS env var is set */
122 if ((env
= getenv("GLUT_FPS")) != NULL
) {
123 if ((_glut_fps
= atoi(env
)) <= 0) {
124 _glut_fps
= 5000; /* 5000 milliseconds */
128 /* Initialize timer */
129 glutGet(GLUT_ELAPSED_TIME
);
134 glutInitDisplayMode (unsigned int mode
)
136 _glut_default
.mode
= mode
;
141 glutInitWindowPosition (int x
, int y
)
149 glutInitWindowSize (int width
, int height
)
151 _glut_default
.width
= width
;
152 _glut_default
.height
= height
;
157 glutInitDisplayString (const char *string
)
159 init_string
= _glut_strdup(string
);
164 glutSetOption (GLenum pname
, int value
)
167 case GLUT_INIT_WINDOW_X
:
168 _glut_default
.x
= value
;
170 case GLUT_INIT_WINDOW_Y
:
171 _glut_default
.y
= value
;
178 glutForceJoystickFunc (void)
184 glutIgnoreKeyRepeat (int ignore
)
190 glutSetKeyRepeat (int repeatMode
)
196 glutVideoPan (int x
, int y
, int w
, int h
)
202 glutVideoResizeGet( GLenum eWhat
)
209 glutSetupVideoResizing (void)
215 glutStopVideoResizing (void)
221 glutVideoResize (int x
, int y
, int w
, int h
)