1 |
root |
1.1 |
#include <stdlib.h> |
2 |
|
|
#include <stdio.h> |
3 |
|
|
#include <string.h> |
4 |
|
|
#include <math.h> |
5 |
|
|
|
6 |
|
|
#include "SDL.h" |
7 |
|
|
|
8 |
|
|
#include "SDL_opengl.h" |
9 |
|
|
|
10 |
|
|
/* Undefine this if you want a flat cube instead of a rainbow cube */ |
11 |
|
|
#define SHADED_CUBE |
12 |
|
|
|
13 |
|
|
/* Define this to be the name of the logo image to use with -logo */ |
14 |
|
|
#define LOGO_FILE "icon.bmp" |
15 |
|
|
|
16 |
|
|
static SDL_Surface *global_image = NULL; |
17 |
|
|
static GLuint global_texture = 0; |
18 |
|
|
|
19 |
root |
1.2 |
#include "entity.h" |
20 |
|
|
|
21 |
root |
1.4 |
#include "txtprt_import.h" |
22 |
|
|
|
23 |
root |
1.1 |
/**********************************************************************/ |
24 |
|
|
|
25 |
root |
1.6 |
view camera; |
26 |
|
|
|
27 |
root |
1.1 |
void |
28 |
|
|
HotKey_ToggleFullScreen (void) |
29 |
|
|
{ |
30 |
|
|
SDL_Surface *screen; |
31 |
|
|
|
32 |
|
|
screen = SDL_GetVideoSurface (); |
33 |
|
|
if (SDL_WM_ToggleFullScreen (screen)) |
34 |
root |
1.5 |
printf ("Toggled fullscreen mode - now %s\n", |
35 |
|
|
(screen->flags & SDL_FULLSCREEN) ? "fullscreen" : "windowed"); |
36 |
root |
1.1 |
else |
37 |
root |
1.5 |
printf ("Unable to toggle fullscreen mode\n"); |
38 |
root |
1.1 |
} |
39 |
|
|
|
40 |
|
|
void |
41 |
|
|
HotKey_ToggleGrab (void) |
42 |
|
|
{ |
43 |
|
|
SDL_GrabMode mode; |
44 |
|
|
|
45 |
|
|
printf ("Ctrl-G: toggling input grab!\n"); |
46 |
|
|
mode = SDL_WM_GrabInput (SDL_GRAB_QUERY); |
47 |
|
|
if (mode == SDL_GRAB_ON) |
48 |
root |
1.5 |
printf ("Grab was on\n"); |
49 |
root |
1.1 |
else |
50 |
root |
1.5 |
printf ("Grab was off\n"); |
51 |
root |
1.1 |
|
52 |
|
|
mode = SDL_WM_GrabInput (mode ? SDL_GRAB_OFF : SDL_GRAB_ON); |
53 |
|
|
if (mode == SDL_GRAB_ON) |
54 |
root |
1.5 |
printf ("Grab is now on\n"); |
55 |
root |
1.1 |
else |
56 |
root |
1.5 |
printf ("Grab is now off\n"); |
57 |
root |
1.1 |
} |
58 |
|
|
|
59 |
|
|
void |
60 |
|
|
HotKey_Iconify (void) |
61 |
|
|
{ |
62 |
|
|
printf ("Ctrl-Z: iconifying window!\n"); |
63 |
|
|
SDL_WM_IconifyWindow (); |
64 |
|
|
} |
65 |
|
|
|
66 |
|
|
int |
67 |
|
|
HandleEvent (SDL_Event * event) |
68 |
|
|
{ |
69 |
|
|
int done; |
70 |
|
|
|
71 |
|
|
done = 0; |
72 |
|
|
switch (event->type) |
73 |
|
|
{ |
74 |
|
|
case SDL_ACTIVEEVENT: |
75 |
|
|
/* See what happened */ |
76 |
|
|
printf ("app %s ", event->active.gain ? "gained" : "lost"); |
77 |
|
|
if (event->active.state & SDL_APPACTIVE) |
78 |
|
|
{ |
79 |
|
|
printf ("active "); |
80 |
|
|
} |
81 |
|
|
else if (event->active.state & SDL_APPMOUSEFOCUS) |
82 |
|
|
{ |
83 |
|
|
printf ("mouse "); |
84 |
|
|
} |
85 |
|
|
else if (event->active.state & SDL_APPINPUTFOCUS) |
86 |
|
|
{ |
87 |
|
|
printf ("input "); |
88 |
|
|
} |
89 |
|
|
|
90 |
|
|
printf ("focus\n"); |
91 |
|
|
break; |
92 |
|
|
|
93 |
|
|
case SDL_KEYDOWN: |
94 |
root |
1.6 |
|
95 |
|
|
if (event->key.keysym.sym == SDLK_UP) |
96 |
|
|
camera.p.z -= 1; |
97 |
|
|
if (event->key.keysym.sym == SDLK_DOWN) |
98 |
|
|
camera.p.z += 1; |
99 |
|
|
if (event->key.keysym.sym == SDLK_LEFT) |
100 |
|
|
camera.p.x -= 1; |
101 |
|
|
if (event->key.keysym.sym == SDLK_RIGHT) |
102 |
|
|
camera.p.x += 1; |
103 |
|
|
|
104 |
root |
1.1 |
if (event->key.keysym.sym == SDLK_ESCAPE) |
105 |
root |
1.6 |
done = 1; |
106 |
root |
1.1 |
|
107 |
|
|
if ((event->key.keysym.sym == SDLK_g) && |
108 |
|
|
(event->key.keysym.mod & KMOD_CTRL)) |
109 |
root |
1.6 |
HotKey_ToggleGrab (); |
110 |
root |
1.1 |
|
111 |
|
|
if ((event->key.keysym.sym == SDLK_z) && |
112 |
|
|
(event->key.keysym.mod & KMOD_CTRL)) |
113 |
root |
1.6 |
HotKey_Iconify (); |
114 |
root |
1.1 |
|
115 |
|
|
if ((event->key.keysym.sym == SDLK_RETURN) && |
116 |
|
|
(event->key.keysym.mod & KMOD_ALT)) |
117 |
root |
1.6 |
HotKey_ToggleFullScreen (); |
118 |
root |
1.1 |
|
119 |
|
|
break; |
120 |
|
|
|
121 |
|
|
case SDL_QUIT: |
122 |
|
|
done = 1; |
123 |
|
|
break; |
124 |
|
|
} |
125 |
|
|
|
126 |
|
|
return (done); |
127 |
|
|
} |
128 |
|
|
|
129 |
|
|
/* Quick utility function for texture creation */ |
130 |
|
|
static int |
131 |
|
|
power_of_two (int input) |
132 |
|
|
{ |
133 |
|
|
int value = 1; |
134 |
|
|
|
135 |
|
|
while (value < input) |
136 |
|
|
{ |
137 |
|
|
value <<= 1; |
138 |
|
|
} |
139 |
|
|
return value; |
140 |
|
|
} |
141 |
|
|
|
142 |
|
|
GLuint |
143 |
|
|
SDL_GL_LoadTexture (SDL_Surface * surface, GLfloat * texcoord) |
144 |
|
|
{ |
145 |
|
|
GLuint texture; |
146 |
|
|
int w, h; |
147 |
|
|
SDL_Surface *image; |
148 |
|
|
SDL_Rect area; |
149 |
|
|
Uint32 saved_flags; |
150 |
|
|
Uint8 saved_alpha; |
151 |
|
|
|
152 |
|
|
/* Use the surface width and height expanded to powers of 2 */ |
153 |
|
|
w = power_of_two (surface->w); |
154 |
|
|
h = power_of_two (surface->h); |
155 |
|
|
texcoord[0] = 0.0f; /* Min X */ |
156 |
|
|
texcoord[1] = 0.0f; /* Min Y */ |
157 |
|
|
texcoord[2] = (GLfloat) surface->w / w; /* Max X */ |
158 |
|
|
texcoord[3] = (GLfloat) surface->h / h; /* Max Y */ |
159 |
|
|
|
160 |
|
|
image = SDL_CreateRGBSurface (SDL_SWSURFACE, w, h, 32, |
161 |
|
|
#if SDL_BYTEORDER == SDL_LIL_ENDIAN /* OpenGL RGBA masks */ |
162 |
|
|
0x000000FF, 0x0000FF00, 0x00FF0000, 0xFF000000 |
163 |
|
|
#else |
164 |
|
|
0xFF000000, 0x00FF0000, 0x0000FF00, 0x000000FF |
165 |
|
|
#endif |
166 |
|
|
); |
167 |
|
|
if (image == NULL) |
168 |
|
|
{ |
169 |
|
|
return 0; |
170 |
|
|
} |
171 |
|
|
|
172 |
|
|
/* Save the alpha blending attributes */ |
173 |
|
|
saved_flags = surface->flags & (SDL_SRCALPHA | SDL_RLEACCELOK); |
174 |
|
|
saved_alpha = surface->format->alpha; |
175 |
|
|
if ((saved_flags & SDL_SRCALPHA) == SDL_SRCALPHA) |
176 |
|
|
{ |
177 |
|
|
SDL_SetAlpha (surface, 0, 0); |
178 |
|
|
} |
179 |
|
|
|
180 |
|
|
/* Copy the surface into the GL texture image */ |
181 |
|
|
area.x = 0; |
182 |
|
|
area.y = 0; |
183 |
|
|
area.w = surface->w; |
184 |
|
|
area.h = surface->h; |
185 |
|
|
SDL_BlitSurface (surface, &area, image, &area); |
186 |
|
|
|
187 |
|
|
/* Restore the alpha blending attributes */ |
188 |
|
|
if ((saved_flags & SDL_SRCALPHA) == SDL_SRCALPHA) |
189 |
|
|
{ |
190 |
|
|
SDL_SetAlpha (surface, saved_flags, saved_alpha); |
191 |
|
|
} |
192 |
|
|
|
193 |
|
|
/* Create an OpenGL texture for the image */ |
194 |
|
|
glGenTextures (1, &texture); |
195 |
|
|
glBindTexture (GL_TEXTURE_2D, texture); |
196 |
|
|
glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); |
197 |
|
|
glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); |
198 |
|
|
glTexImage2D (GL_TEXTURE_2D, |
199 |
|
|
0, |
200 |
|
|
GL_RGBA, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, image->pixels); |
201 |
|
|
SDL_FreeSurface (image); /* No longer needed */ |
202 |
|
|
|
203 |
|
|
return texture; |
204 |
|
|
} |
205 |
|
|
|
206 |
|
|
int |
207 |
|
|
RunGLTest (int argc, char *argv[], |
208 |
|
|
int logo, int slowly, int bpp, float gamma, int noframe, int fsaa) |
209 |
|
|
{ |
210 |
|
|
int i; |
211 |
|
|
int rgb_size[3]; |
212 |
|
|
int w = 640; |
213 |
|
|
int h = 480; |
214 |
|
|
int done = 0; |
215 |
|
|
int frames; |
216 |
|
|
Uint32 start_time, this_time; |
217 |
root |
1.2 |
Uint32 video_flags; |
218 |
root |
1.1 |
int value; |
219 |
|
|
|
220 |
|
|
if (SDL_Init (SDL_INIT_VIDEO) < 0) |
221 |
|
|
{ |
222 |
|
|
fprintf (stderr, "Couldn't initialize SDL: %s\n", SDL_GetError ()); |
223 |
|
|
exit (1); |
224 |
|
|
} |
225 |
|
|
|
226 |
|
|
/* See if we should detect the display depth */ |
227 |
|
|
if (bpp == 0) |
228 |
|
|
{ |
229 |
|
|
if (SDL_GetVideoInfo ()->vfmt->BitsPerPixel <= 8) |
230 |
root |
1.3 |
bpp = 8; |
231 |
root |
1.1 |
else |
232 |
root |
1.3 |
bpp = 16; /* More doesn't seem to work */ |
233 |
root |
1.1 |
} |
234 |
|
|
|
235 |
root |
1.2 |
video_flags = SDL_OPENGL; |
236 |
|
|
|
237 |
root |
1.1 |
for (i = 1; argv[i]; ++i) |
238 |
root |
1.3 |
if (strcmp (argv[1], "-fullscreen") == 0) |
239 |
|
|
video_flags |= SDL_FULLSCREEN; |
240 |
root |
1.1 |
|
241 |
|
|
if (noframe) |
242 |
root |
1.3 |
video_flags |= SDL_NOFRAME; |
243 |
root |
1.1 |
|
244 |
|
|
/* Initialize the display */ |
245 |
|
|
switch (bpp) |
246 |
|
|
{ |
247 |
|
|
case 8: |
248 |
|
|
rgb_size[0] = 3; |
249 |
|
|
rgb_size[1] = 3; |
250 |
|
|
rgb_size[2] = 2; |
251 |
|
|
break; |
252 |
root |
1.3 |
|
253 |
root |
1.1 |
case 15: |
254 |
|
|
case 16: |
255 |
|
|
rgb_size[0] = 5; |
256 |
|
|
rgb_size[1] = 5; |
257 |
|
|
rgb_size[2] = 5; |
258 |
|
|
break; |
259 |
root |
1.3 |
|
260 |
root |
1.1 |
default: |
261 |
|
|
rgb_size[0] = 8; |
262 |
|
|
rgb_size[1] = 8; |
263 |
|
|
rgb_size[2] = 8; |
264 |
|
|
break; |
265 |
|
|
} |
266 |
|
|
SDL_GL_SetAttribute (SDL_GL_RED_SIZE, rgb_size[0]); |
267 |
|
|
SDL_GL_SetAttribute (SDL_GL_GREEN_SIZE, rgb_size[1]); |
268 |
|
|
SDL_GL_SetAttribute (SDL_GL_BLUE_SIZE, rgb_size[2]); |
269 |
|
|
SDL_GL_SetAttribute (SDL_GL_DEPTH_SIZE, 16); |
270 |
|
|
SDL_GL_SetAttribute (SDL_GL_DOUBLEBUFFER, 1); |
271 |
root |
1.3 |
|
272 |
root |
1.1 |
if (fsaa) |
273 |
|
|
{ |
274 |
|
|
SDL_GL_SetAttribute (SDL_GL_MULTISAMPLEBUFFERS, 1); |
275 |
|
|
SDL_GL_SetAttribute (SDL_GL_MULTISAMPLESAMPLES, fsaa); |
276 |
|
|
} |
277 |
root |
1.3 |
|
278 |
root |
1.1 |
if (SDL_SetVideoMode (w, h, bpp, video_flags) == NULL) |
279 |
|
|
{ |
280 |
|
|
fprintf (stderr, "Couldn't set GL mode: %s\n", SDL_GetError ()); |
281 |
|
|
SDL_Quit (); |
282 |
|
|
exit (1); |
283 |
|
|
} |
284 |
|
|
|
285 |
|
|
printf ("Screen BPP: %d\n", SDL_GetVideoSurface ()->format->BitsPerPixel); |
286 |
|
|
printf ("\n"); |
287 |
|
|
printf ("Vendor : %s\n", glGetString (GL_VENDOR)); |
288 |
|
|
printf ("Renderer : %s\n", glGetString (GL_RENDERER)); |
289 |
|
|
printf ("Version : %s\n", glGetString (GL_VERSION)); |
290 |
|
|
printf ("Extensions : %s\n", glGetString (GL_EXTENSIONS)); |
291 |
|
|
printf ("\n"); |
292 |
|
|
|
293 |
|
|
SDL_GL_GetAttribute (SDL_GL_RED_SIZE, &value); |
294 |
|
|
printf ("SDL_GL_RED_SIZE: requested %d, got %d\n", rgb_size[0], value); |
295 |
|
|
SDL_GL_GetAttribute (SDL_GL_GREEN_SIZE, &value); |
296 |
|
|
printf ("SDL_GL_GREEN_SIZE: requested %d, got %d\n", rgb_size[1], value); |
297 |
|
|
SDL_GL_GetAttribute (SDL_GL_BLUE_SIZE, &value); |
298 |
|
|
printf ("SDL_GL_BLUE_SIZE: requested %d, got %d\n", rgb_size[2], value); |
299 |
|
|
SDL_GL_GetAttribute (SDL_GL_DEPTH_SIZE, &value); |
300 |
|
|
printf ("SDL_GL_DEPTH_SIZE: requested %d, got %d\n", bpp, value); |
301 |
|
|
SDL_GL_GetAttribute (SDL_GL_DOUBLEBUFFER, &value); |
302 |
|
|
printf ("SDL_GL_DOUBLEBUFFER: requested 1, got %d\n", value); |
303 |
root |
1.3 |
|
304 |
root |
1.1 |
if (fsaa) |
305 |
|
|
{ |
306 |
|
|
SDL_GL_GetAttribute (SDL_GL_MULTISAMPLEBUFFERS, &value); |
307 |
|
|
printf ("SDL_GL_MULTISAMPLEBUFFERS: requested 1, got %d\n", value); |
308 |
|
|
SDL_GL_GetAttribute (SDL_GL_MULTISAMPLESAMPLES, &value); |
309 |
|
|
printf ("SDL_GL_MULTISAMPLESAMPLES: requested %d, got %d\n", fsaa, |
310 |
|
|
value); |
311 |
|
|
} |
312 |
|
|
|
313 |
|
|
/* Set the window manager title bar */ |
314 |
root |
1.12 |
SDL_WM_SetCaption ("libgender rendering test", "gendertest"); |
315 |
root |
1.1 |
|
316 |
|
|
/* Set the gamma for the window */ |
317 |
|
|
if (gamma != 0.0) |
318 |
root |
1.3 |
SDL_SetGamma (gamma, gamma, gamma); |
319 |
root |
1.1 |
|
320 |
root |
1.13 |
camera.orig.x = camera.orig.y = camera.orig.z = 0; |
321 |
root |
1.6 |
camera.p = point (0, 0, 10); |
322 |
|
|
camera.d = vec3 (0, 0, -1); |
323 |
|
|
camera.u = vec3 (0, 1, 0); |
324 |
|
|
camera.w = w; camera.h = h; |
325 |
|
|
camera.fov = 90; |
326 |
root |
1.1 |
|
327 |
|
|
glMatrixMode (GL_MODELVIEW); |
328 |
|
|
glLoadIdentity (); |
329 |
|
|
|
330 |
root |
1.16 |
glEnable (GL_CULL_FACE); |
331 |
root |
1.1 |
glEnable (GL_DEPTH_TEST); |
332 |
root |
1.11 |
glShadeModel (GL_SMOOTH); |
333 |
root |
1.6 |
|
334 |
root |
1.3 |
glEnable (GL_LIGHTING); |
335 |
root |
1.9 |
//GLfloat lightc[4] = { 1, 0.1, 0.1, 1 }; |
336 |
root |
1.6 |
//glLightf (GL_LIGHT0, GL_QUADRATIC_ATTENUATION); |
337 |
root |
1.9 |
//glLightfv (GL_LIGHT0, GL_DIFFUSE, lightc); |
338 |
root |
1.6 |
glEnable (GL_LIGHT0); |
339 |
root |
1.1 |
|
340 |
|
|
/* Loop until done. */ |
341 |
|
|
start_time = SDL_GetTicks (); |
342 |
|
|
frames = 0; |
343 |
root |
1.16 |
|
344 |
|
|
draw_context c (camera); |
345 |
|
|
|
346 |
root |
1.1 |
while (!done) |
347 |
|
|
{ |
348 |
|
|
GLenum gl_error; |
349 |
|
|
char *sdl_error; |
350 |
|
|
SDL_Event event; |
351 |
|
|
|
352 |
|
|
/* Do our drawing, too. */ |
353 |
|
|
glClearColor (0.0, 0.0, 0.0, 1.0); |
354 |
|
|
glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); |
355 |
|
|
|
356 |
root |
1.6 |
GLfloat lightp[4]; |
357 |
|
|
lightp[0] = camera.p.x; |
358 |
|
|
lightp[1] = camera.p.y; |
359 |
|
|
lightp[2] = camera.p.z; |
360 |
|
|
lightp[3] = 1; |
361 |
|
|
glLightfv (GL_LIGHT0, GL_POSITION, lightp); |
362 |
|
|
|
363 |
root |
1.5 |
#if 0 |
364 |
root |
1.3 |
static GLfloat ry; |
365 |
root |
1.13 |
ry += 0.001; |
366 |
|
|
camera.d.x = cos (ry); |
367 |
|
|
camera.d.z = sin (ry); |
368 |
|
|
//camera.d.y = sin (ry * 0.1); |
369 |
root |
1.5 |
#endif |
370 |
root |
1.1 |
|
371 |
root |
1.16 |
c.mode = draw_context::DEPTH; |
372 |
|
|
camera.draw (c); |
373 |
|
|
c.drawn.clear (); |
374 |
root |
1.9 |
c.mode = draw_context::LIGHTED; |
375 |
root |
1.6 |
camera.draw (c); |
376 |
root |
1.1 |
|
377 |
|
|
SDL_GL_SwapBuffers (); |
378 |
root |
1.15 |
timer.frame (); |
379 |
root |
1.1 |
|
380 |
|
|
/* Check for error conditions. */ |
381 |
|
|
gl_error = glGetError (); |
382 |
|
|
|
383 |
|
|
if (gl_error != GL_NO_ERROR) |
384 |
root |
1.3 |
fprintf (stderr, "testgl: OpenGL error: %d\n", gl_error); |
385 |
root |
1.1 |
|
386 |
|
|
sdl_error = SDL_GetError (); |
387 |
|
|
|
388 |
|
|
if (sdl_error[0] != '\0') |
389 |
|
|
{ |
390 |
|
|
fprintf (stderr, "testgl: SDL error '%s'\n", sdl_error); |
391 |
|
|
SDL_ClearError (); |
392 |
|
|
} |
393 |
|
|
|
394 |
|
|
/* Allow the user to see what's happening */ |
395 |
root |
1.9 |
//SDL_Delay (20); |
396 |
root |
1.1 |
|
397 |
|
|
/* Check if there's a pending event. */ |
398 |
|
|
while (SDL_PollEvent (&event)) |
399 |
|
|
{ |
400 |
|
|
done = HandleEvent (&event); |
401 |
|
|
} |
402 |
|
|
++frames; |
403 |
|
|
} |
404 |
|
|
|
405 |
|
|
/* Print out the frames per second */ |
406 |
|
|
this_time = SDL_GetTicks (); |
407 |
|
|
if (this_time != start_time) |
408 |
|
|
{ |
409 |
|
|
printf ("%2.2f FPS\n", |
410 |
|
|
((float) frames / (this_time - start_time)) * 1000.0); |
411 |
|
|
} |
412 |
|
|
|
413 |
|
|
if (global_image) |
414 |
|
|
{ |
415 |
|
|
SDL_FreeSurface (global_image); |
416 |
|
|
global_image = NULL; |
417 |
|
|
} |
418 |
|
|
if (global_texture) |
419 |
|
|
{ |
420 |
|
|
glDeleteTextures (1, &global_texture); |
421 |
|
|
global_texture = 0; |
422 |
|
|
} |
423 |
|
|
|
424 |
|
|
/* Destroy our GL context, etc. */ |
425 |
|
|
SDL_Quit (); |
426 |
|
|
return (0); |
427 |
|
|
} |
428 |
|
|
|
429 |
|
|
int |
430 |
|
|
main (int argc, char *argv[]) |
431 |
|
|
{ |
432 |
|
|
int i, logo; |
433 |
|
|
int numtests; |
434 |
|
|
int bpp = 0; |
435 |
|
|
int slowly; |
436 |
|
|
float gamma = 0.0; |
437 |
|
|
int noframe = 0; |
438 |
|
|
int fsaa = 0; |
439 |
root |
1.4 |
|
440 |
|
|
// load a entity |
441 |
root |
1.15 |
for (int i = 0; i < 7; i++) { |
442 |
root |
1.4 |
txtprt_parser p; |
443 |
root |
1.15 |
entity_anim *f = new entity_anim; |
444 |
root |
1.8 |
entity *e; |
445 |
root |
1.4 |
try { |
446 |
root |
1.5 |
e = p.read ("test.blasc"); |
447 |
root |
1.4 |
} catch (txtprt_i_exception & e) { |
448 |
|
|
cout << "ERR: " << e.msg << endl; |
449 |
|
|
} |
450 |
root |
1.13 |
f->set (e); |
451 |
root |
1.14 |
f->m.translate (vec3 (i, -1, 0)); |
452 |
root |
1.16 |
f->vx = 0; |
453 |
|
|
f->vy = 0; |
454 |
|
|
f->vz = 0; |
455 |
root |
1.13 |
f->show (); |
456 |
root |
1.12 |
} |
457 |
root |
1.1 |
|
458 |
|
|
logo = 0; |
459 |
|
|
slowly = 0; |
460 |
|
|
numtests = 1; |
461 |
|
|
for (i = 1; argv[i]; ++i) |
462 |
|
|
{ |
463 |
|
|
if (strcmp (argv[i], "-twice") == 0) |
464 |
|
|
{ |
465 |
|
|
++numtests; |
466 |
|
|
} |
467 |
|
|
if (strcmp (argv[i], "-slow") == 0) |
468 |
|
|
{ |
469 |
|
|
slowly = 1; |
470 |
|
|
} |
471 |
|
|
if (strcmp (argv[i], "-bpp") == 0) |
472 |
|
|
{ |
473 |
|
|
bpp = atoi (argv[++i]); |
474 |
|
|
} |
475 |
|
|
if (strcmp (argv[i], "-gamma") == 0) |
476 |
|
|
{ |
477 |
|
|
gamma = (float) atof (argv[++i]); |
478 |
|
|
} |
479 |
|
|
if (strcmp (argv[i], "-noframe") == 0) |
480 |
|
|
{ |
481 |
|
|
noframe = 1; |
482 |
|
|
} |
483 |
|
|
if (strcmp (argv[i], "-fsaa") == 0) |
484 |
|
|
{ |
485 |
|
|
++fsaa; |
486 |
|
|
} |
487 |
|
|
if (strncmp (argv[i], "-h", 2) == 0) |
488 |
|
|
{ |
489 |
|
|
printf |
490 |
|
|
("Usage: %s [-twice] [-logo] [-slow] [-bpp n] [-gamma n] [-noframe] [-fsaa]\n", |
491 |
|
|
argv[0]); |
492 |
|
|
exit (0); |
493 |
|
|
} |
494 |
|
|
} |
495 |
|
|
for (i = 0; i < numtests; ++i) |
496 |
|
|
{ |
497 |
|
|
RunGLTest (argc, argv, logo, slowly, bpp, gamma, noframe, fsaa); |
498 |
|
|
} |
499 |
|
|
return 0; |
500 |
|
|
} |