1 | #include <stdlib.h> |
1 | #include <stdlib.h> |
2 | #include <stdio.h> |
2 | #include <stdio.h> |
3 | #include <string.h> |
3 | #include <string.h> |
4 | #include <math.h> |
4 | #include <math.h> |
5 | |
5 | |
|
|
6 | #include "opengl.h" |
|
|
7 | |
6 | #include "SDL.h" |
8 | #include "SDL.h" |
7 | |
|
|
8 | #include "SDL_opengl.h" |
9 | #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 | |
10 | |
16 | static SDL_Surface *global_image = NULL; |
11 | static SDL_Surface *global_image = NULL; |
17 | static GLuint global_texture = 0; |
12 | static GLuint global_texture = 0; |
18 | |
13 | |
|
|
14 | #include "util.h" |
19 | #include "entity.h" |
15 | #include "entity.h" |
20 | |
|
|
21 | #include "txtprt_import.h" |
16 | #include "txtprt_import.h" |
22 | |
17 | |
23 | /**********************************************************************/ |
18 | /**********************************************************************/ |
24 | |
19 | |
25 | view camera; |
20 | view camera; |
|
|
21 | vec3 camera_velocity; |
|
|
22 | float camera_angle, camera_angle2, camera_velocity_angle, camera_velocity_angle2; |
|
|
23 | float camera_velocity_factor = 80; |
26 | |
24 | |
27 | void |
25 | void |
28 | HotKey_ToggleFullScreen (void) |
26 | HotKey_ToggleFullScreen (void) |
29 | { |
27 | { |
30 | SDL_Surface *screen; |
28 | SDL_Surface *screen; |
… | |
… | |
73 | { |
71 | { |
74 | case SDL_ACTIVEEVENT: |
72 | case SDL_ACTIVEEVENT: |
75 | /* See what happened */ |
73 | /* See what happened */ |
76 | printf ("app %s ", event->active.gain ? "gained" : "lost"); |
74 | printf ("app %s ", event->active.gain ? "gained" : "lost"); |
77 | if (event->active.state & SDL_APPACTIVE) |
75 | if (event->active.state & SDL_APPACTIVE) |
78 | { |
|
|
79 | printf ("active "); |
76 | printf ("active "); |
80 | } |
|
|
81 | else if (event->active.state & SDL_APPMOUSEFOCUS) |
77 | else if (event->active.state & SDL_APPMOUSEFOCUS) |
82 | { |
|
|
83 | printf ("mouse "); |
78 | printf ("mouse "); |
84 | } |
|
|
85 | else if (event->active.state & SDL_APPINPUTFOCUS) |
79 | else if (event->active.state & SDL_APPINPUTFOCUS) |
86 | { |
|
|
87 | printf ("input "); |
80 | printf ("input "); |
88 | } |
|
|
89 | |
81 | |
90 | printf ("focus\n"); |
82 | printf ("focus\n"); |
91 | break; |
83 | break; |
92 | |
84 | |
93 | case SDL_KEYDOWN: |
85 | case SDL_KEYDOWN: |
94 | |
|
|
95 | if (event->key.keysym.sym == SDLK_UP) |
86 | if (event->key.keysym.sym == SDLK_UP) camera_velocity.z--; |
96 | camera.p.z -= 1; |
|
|
97 | if (event->key.keysym.sym == SDLK_DOWN) |
87 | if (event->key.keysym.sym == SDLK_DOWN) camera_velocity.z++; |
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) |
88 | if (event->key.keysym.sym == SDLK_RIGHT) camera_velocity_angle++; |
102 | camera.p.x += 1; |
89 | if (event->key.keysym.sym == SDLK_LEFT) camera_velocity_angle--; |
|
|
90 | if (event->key.keysym.sym == SDLK_PAGEUP) camera_velocity_angle2++; |
|
|
91 | if (event->key.keysym.sym == SDLK_PAGEDOWN) camera_velocity_angle2--; |
|
|
92 | if (event->key.keysym.sym == SDLK_e) camera_velocity.y--; |
|
|
93 | if (event->key.keysym.sym == SDLK_q) camera_velocity.y++; |
|
|
94 | if (event->key.keysym.sym == SDLK_v) camera_velocity_factor *= 1.5; |
|
|
95 | if (event->key.keysym.sym == SDLK_b) camera_velocity_factor /= 1.5; |
103 | |
96 | |
104 | if (event->key.keysym.sym == SDLK_ESCAPE) |
97 | if (event->key.keysym.sym == SDLK_ESCAPE) |
105 | done = 1; |
98 | done = 1; |
106 | |
99 | |
107 | if ((event->key.keysym.sym == SDLK_g) && |
100 | if ((event->key.keysym.sym == SDLK_g) && |
… | |
… | |
116 | (event->key.keysym.mod & KMOD_ALT)) |
109 | (event->key.keysym.mod & KMOD_ALT)) |
117 | HotKey_ToggleFullScreen (); |
110 | HotKey_ToggleFullScreen (); |
118 | |
111 | |
119 | break; |
112 | break; |
120 | |
113 | |
|
|
114 | case SDL_KEYUP: |
|
|
115 | if (event->key.keysym.sym == SDLK_UP) camera_velocity.z++; |
|
|
116 | if (event->key.keysym.sym == SDLK_DOWN) camera_velocity.z--; |
|
|
117 | if (event->key.keysym.sym == SDLK_LEFT) camera_velocity_angle++; |
|
|
118 | if (event->key.keysym.sym == SDLK_RIGHT) camera_velocity_angle--; |
|
|
119 | if (event->key.keysym.sym == SDLK_PAGEUP) camera_velocity_angle2--; |
|
|
120 | if (event->key.keysym.sym == SDLK_PAGEDOWN) camera_velocity_angle2++; |
|
|
121 | if (event->key.keysym.sym == SDLK_e) camera_velocity.y++; |
|
|
122 | if (event->key.keysym.sym == SDLK_q) camera_velocity.y--; |
|
|
123 | break; |
|
|
124 | |
121 | case SDL_QUIT: |
125 | case SDL_QUIT: |
122 | done = 1; |
126 | done = 1; |
123 | break; |
127 | break; |
124 | } |
128 | } |
125 | |
129 | |
126 | return (done); |
130 | return (done); |
127 | } |
131 | } |
128 | |
132 | |
129 | /* Quick utility function for texture creation */ |
133 | void draw_floor (int size, int dx, int dy, int dz) |
130 | static int |
|
|
131 | power_of_two (int input) |
|
|
132 | { |
134 | { |
133 | int value = 1; |
135 | int x, z, ry; |
134 | |
136 | |
135 | while (value < input) |
137 | for (x = 0; x < 10; x++) |
136 | { |
|
|
137 | value <<= 1; |
|
|
138 | } |
138 | { |
139 | return value; |
139 | for (z = 0; z < 10; z++) |
140 | } |
140 | { |
|
|
141 | vector<vertex_t2f_n3f_v3f> pts; |
|
|
142 | pts.push_back (vertex_t2f_n3f_v3f (point ( 0, 0, 0), vec3 (0, 1, 0), tex2 (0, 0))); |
|
|
143 | pts.push_back (vertex_t2f_n3f_v3f (point ( 0, 0, size), vec3 (0, 1, 0), tex2 (0, 1))); |
|
|
144 | pts.push_back (vertex_t2f_n3f_v3f (point (size, 0, size), vec3 (0, 1, 0), tex2 (1, 1))); |
|
|
145 | pts.push_back (vertex_t2f_n3f_v3f (point (size, 0, 0), vec3 (0, 1, 0), tex2 (1, 0))); |
141 | |
146 | |
142 | GLuint |
147 | geometry_quads *q = new geometry_quads; |
143 | SDL_GL_LoadTexture (SDL_Surface * surface, GLfloat * texcoord) |
148 | q->m = new simple_material; |
144 | { |
149 | q->set (pts); |
145 | GLuint texture; |
150 | entity *e = new entity (q); |
146 | int w, h; |
151 | e->move (vec3 (dx + x * size, dy, dz + z * size)); |
147 | SDL_Surface *image; |
152 | e->show (); |
148 | SDL_Rect area; |
153 | } |
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 | { |
154 | } |
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 | } |
155 | } |
205 | |
156 | |
|
|
157 | void draw_test_nurb () |
|
|
158 | { |
|
|
159 | geometry_nurbs *q = new geometry_nurbs; |
|
|
160 | q->set (); |
|
|
161 | entity *e = new entity (q); |
|
|
162 | e->move (vec3 (10, 3, -4)); |
|
|
163 | e->show (); |
|
|
164 | } |
|
|
165 | |
|
|
166 | extern void draw_level (); |
206 | int |
167 | int |
207 | RunGLTest (int argc, char *argv[], |
168 | RunGLTest (int argc, char *argv[], |
208 | int logo, int slowly, int bpp, float gamma, int noframe, int fsaa) |
169 | int logo, int slowly, int bpp, float gamma, int noframe, int fsaa) |
209 | { |
170 | { |
210 | int i; |
171 | int i; |
… | |
… | |
214 | int done = 0; |
175 | int done = 0; |
215 | int frames; |
176 | int frames; |
216 | Uint32 start_time, this_time; |
177 | Uint32 start_time, this_time; |
217 | Uint32 video_flags; |
178 | Uint32 video_flags; |
218 | int value; |
179 | int value; |
|
|
180 | GLenum gl_error; |
219 | |
181 | |
220 | if (SDL_Init (SDL_INIT_VIDEO) < 0) |
182 | if (SDL_Init (SDL_INIT_VIDEO) < 0) |
221 | { |
183 | { |
222 | fprintf (stderr, "Couldn't initialize SDL: %s\n", SDL_GetError ()); |
184 | fprintf (stderr, "Couldn't initialize SDL: %s\n", SDL_GetError ()); |
223 | exit (1); |
185 | exit (1); |
… | |
… | |
261 | rgb_size[0] = 8; |
223 | rgb_size[0] = 8; |
262 | rgb_size[1] = 8; |
224 | rgb_size[1] = 8; |
263 | rgb_size[2] = 8; |
225 | rgb_size[2] = 8; |
264 | break; |
226 | break; |
265 | } |
227 | } |
|
|
228 | |
266 | SDL_GL_SetAttribute (SDL_GL_RED_SIZE, rgb_size[0]); |
229 | SDL_GL_SetAttribute (SDL_GL_RED_SIZE, rgb_size[0]); |
267 | SDL_GL_SetAttribute (SDL_GL_GREEN_SIZE, rgb_size[1]); |
230 | SDL_GL_SetAttribute (SDL_GL_GREEN_SIZE, rgb_size[1]); |
268 | SDL_GL_SetAttribute (SDL_GL_BLUE_SIZE, rgb_size[2]); |
231 | SDL_GL_SetAttribute (SDL_GL_BLUE_SIZE, rgb_size[2]); |
269 | SDL_GL_SetAttribute (SDL_GL_DEPTH_SIZE, 16); |
232 | SDL_GL_SetAttribute (SDL_GL_DEPTH_SIZE, 16); |
270 | SDL_GL_SetAttribute (SDL_GL_DOUBLEBUFFER, 1); |
233 | SDL_GL_SetAttribute (SDL_GL_DOUBLEBUFFER, 1); |
… | |
… | |
309 | printf ("SDL_GL_MULTISAMPLESAMPLES: requested %d, got %d\n", fsaa, |
272 | printf ("SDL_GL_MULTISAMPLESAMPLES: requested %d, got %d\n", fsaa, |
310 | value); |
273 | value); |
311 | } |
274 | } |
312 | |
275 | |
313 | /* Set the window manager title bar */ |
276 | /* Set the window manager title bar */ |
314 | SDL_WM_SetCaption ("SDL GL test", "testgl"); |
277 | SDL_WM_SetCaption ("libgender rendering test", "gendertest"); |
315 | |
278 | |
316 | /* Set the gamma for the window */ |
279 | /* Set the gamma for the window */ |
317 | if (gamma != 0.0) |
280 | if (gamma != 0.0) |
318 | SDL_SetGamma (gamma, gamma, gamma); |
281 | SDL_SetGamma (gamma, gamma, gamma); |
319 | |
282 | |
|
|
283 | entity *planet = new entity (new geometry_sphere (10)); |
|
|
284 | planet->move (vec3 (0, 0, -20)); |
|
|
285 | planet->show (); |
|
|
286 | |
|
|
287 | #if 1 |
|
|
288 | for (int i = 0; i < 20; i++) |
|
|
289 | { |
|
|
290 | // load a entity |
|
|
291 | txtprt_parser p; |
|
|
292 | geometry *g; |
|
|
293 | try |
|
|
294 | { |
|
|
295 | g = p.read ("test.blasc"); |
|
|
296 | } |
|
|
297 | catch (txtprt_i_exception & e) |
|
|
298 | { |
|
|
299 | cout << "ERR: " << e.msg << endl; |
|
|
300 | } |
|
|
301 | |
|
|
302 | entity *e = new entity (g); |
|
|
303 | e->move (vec3 (i*5, -3, -i*10)); |
|
|
304 | e->show (); |
|
|
305 | } |
|
|
306 | |
|
|
307 | { |
|
|
308 | entity *planet = new entity (new geometry_sphere (1e9)); |
|
|
309 | planet->move (vec3 (0, 0, -1.5e9)); |
|
|
310 | planet->show (); |
|
|
311 | } |
|
|
312 | |
|
|
313 | { |
|
|
314 | entity *planet = new entity (new geometry_sphere (4e15)); |
|
|
315 | planet->move (vec3 (0, 0, 1e17)); |
|
|
316 | planet->show (); |
|
|
317 | } |
|
|
318 | |
|
|
319 | draw_floor (10, -500, -10, -1000); |
|
|
320 | draw_level (); |
|
|
321 | //draw_test_nurb (); |
|
|
322 | #endif |
|
|
323 | |
|
|
324 | //camera.orig.x = 108; camera.orig.y = 0; camera.orig.z = -368; |
|
|
325 | camera.orig.x = 0; camera.orig.y = 0; camera.orig.z = 0; |
320 | camera.p = point (0, 0, 10); |
326 | camera.p = point (0, 0, 10); |
321 | camera.d = vec3 (0, 0, -1); |
327 | camera.d = vec3 (0, 0, -1); |
322 | camera.u = vec3 (0, 1, 0); |
328 | camera.u = vec3 (0, 1, 0); |
323 | camera.w = w; camera.h = h; |
329 | camera.w = w; camera.h = h; |
324 | camera.fov = 90; |
330 | camera.fov = 35; |
|
|
331 | camera.z_near = 1.; |
325 | |
332 | |
326 | glMatrixMode (GL_MODELVIEW); |
|
|
327 | glLoadIdentity (); |
|
|
328 | |
|
|
329 | glEnable (GL_DEPTH_TEST); |
|
|
330 | |
|
|
331 | glDepthFunc (GL_LESS); |
|
|
332 | |
|
|
333 | glShadeModel (GL_SMOOTH); |
|
|
334 | |
|
|
335 | glEnable (GL_LIGHTING); |
|
|
336 | |
|
|
337 | //GLfloat lightc[4] = { 1, 0.1, 0.1, 1 }; |
|
|
338 | //glLightf (GL_LIGHT0, GL_QUADRATIC_ATTENUATION); |
|
|
339 | //glLightfv (GL_LIGHT0, GL_DIFFUSE, lightc); |
|
|
340 | glEnable (GL_LIGHT0); |
|
|
341 | glEnable (GL_COLOR_MATERIAL); |
333 | glEnable (GL_CULL_FACE); |
|
|
334 | |
|
|
335 | init_shaders (); |
|
|
336 | |
|
|
337 | osama_material osa_mat; |
342 | |
338 | |
343 | /* Loop until done. */ |
339 | /* Loop until done. */ |
344 | start_time = SDL_GetTicks (); |
340 | start_time = SDL_GetTicks (); |
345 | frames = 0; |
341 | frames = 0; |
|
|
342 | |
346 | while (!done) |
343 | while (!done) |
347 | { |
344 | { |
348 | GLenum gl_error; |
|
|
349 | char *sdl_error; |
345 | char *sdl_error; |
350 | SDL_Event event; |
346 | SDL_Event event; |
351 | |
347 | |
352 | /* Do our drawing, too. */ |
348 | camera_angle += 180 * camera_velocity_angle * timer.diff; |
353 | glClearColor (0.0, 0.0, 0.0, 1.0); |
349 | camera_angle2 += 180 * camera_velocity_angle2 * timer.diff; |
354 | glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); |
|
|
355 | |
350 | |
356 | GLfloat lightp[4]; |
351 | vec3 geradeaus = matrix::rotation (-camera_angle, vec3 (0, 1, 0)) * vec3 (0, 0, -1); |
357 | lightp[0] = camera.p.x; |
352 | vec3 right = matrix::rotation (90., vec3 (0, 1, 0)) * geradeaus; |
358 | lightp[1] = camera.p.y; |
353 | |
359 | lightp[2] = camera.p.z; |
354 | camera.d = matrix::rotation (camera_angle2, right) * geradeaus; |
360 | lightp[3] = 1; |
355 | camera.u = cross (camera.d, right); |
361 | glLightfv (GL_LIGHT0, GL_POSITION, lightp); |
356 | |
|
|
357 | camera.p = camera.p - camera.d * (camera_velocity_factor * timer.diff) * camera_velocity.z; |
|
|
358 | camera.p = camera.p - camera.u * (camera_velocity_factor * timer.diff) * camera_velocity.y; |
|
|
359 | |
|
|
360 | osa_mat.begin (); |
|
|
361 | |
|
|
362 | camera.begin (); |
|
|
363 | camera.render (view::DEPTH); |
|
|
364 | camera.render (view::POSTDEPTH); |
|
|
365 | camera.render (view::LIGHTED); |
|
|
366 | camera.end (); |
|
|
367 | |
|
|
368 | SDL_GL_SwapBuffers (); |
|
|
369 | timer.frame (); |
|
|
370 | |
|
|
371 | osa_mat.end (); |
362 | |
372 | |
363 | #if 0 |
373 | #if 0 |
364 | static GLfloat ry; |
|
|
365 | ry += 0.03; |
|
|
366 | v.d.x = cos (ry); |
|
|
367 | v.d.z = sin (ry); |
|
|
368 | #endif |
|
|
369 | |
|
|
370 | draw_context c; |
|
|
371 | c.mode = draw_context::LIGHTED; |
|
|
372 | camera.draw (c); |
|
|
373 | |
|
|
374 | SDL_GL_SwapBuffers (); |
|
|
375 | |
|
|
376 | /* Check for error conditions. */ |
374 | /* Check for error conditions. */ |
377 | gl_error = glGetError (); |
375 | gl_error = glGetError (); |
378 | |
376 | |
379 | if (gl_error != GL_NO_ERROR) |
|
|
380 | fprintf (stderr, "testgl: OpenGL error: %d\n", gl_error); |
377 | if (gl_error != GL_NO_ERROR) fprintf (stderr, "testgl: OpenGL error: %d\n", gl_error); |
381 | |
378 | |
382 | sdl_error = SDL_GetError (); |
379 | sdl_error = SDL_GetError (); |
383 | |
380 | |
384 | if (sdl_error[0] != '\0') |
381 | if (sdl_error[0] != '\0') |
385 | { |
382 | { |
386 | fprintf (stderr, "testgl: SDL error '%s'\n", sdl_error); |
383 | fprintf (stderr, "testgl: SDL error '%s'\n", sdl_error); |
387 | SDL_ClearError (); |
384 | SDL_ClearError (); |
388 | } |
385 | } |
389 | |
386 | |
390 | /* Allow the user to see what's happening */ |
387 | /* Allow the user to see what's happening */ |
391 | //SDL_Delay (20); |
388 | //SDL_Delay (40); |
|
|
389 | #endif |
392 | |
390 | |
393 | /* Check if there's a pending event. */ |
391 | /* Check if there's a pending event. */ |
394 | while (SDL_PollEvent (&event)) |
392 | while (SDL_PollEvent (&event)) |
395 | { |
|
|
396 | done = HandleEvent (&event); |
393 | done = HandleEvent (&event); |
397 | } |
394 | |
|
|
395 | |
398 | ++frames; |
396 | ++frames; |
399 | } |
397 | } |
400 | |
398 | |
401 | /* Print out the frames per second */ |
399 | /* Print out the frames per second */ |
402 | this_time = SDL_GetTicks (); |
400 | this_time = SDL_GetTicks (); |
… | |
… | |
419 | |
417 | |
420 | /* Destroy our GL context, etc. */ |
418 | /* Destroy our GL context, etc. */ |
421 | SDL_Quit (); |
419 | SDL_Quit (); |
422 | return (0); |
420 | return (0); |
423 | } |
421 | } |
424 | |
|
|
425 | int |
422 | int |
426 | main (int argc, char *argv[]) |
423 | main (int argc, char *argv[]) |
427 | { |
424 | { |
428 | int i, logo; |
425 | int i, logo; |
429 | int numtests; |
426 | int numtests; |
… | |
… | |
431 | int slowly; |
428 | int slowly; |
432 | float gamma = 0.0; |
429 | float gamma = 0.0; |
433 | int noframe = 0; |
430 | int noframe = 0; |
434 | int fsaa = 0; |
431 | int fsaa = 0; |
435 | |
432 | |
436 | // load a entity |
|
|
437 | txtprt_parser p; |
|
|
438 | entity *e; |
|
|
439 | try { |
|
|
440 | e = p.read ("test.blasc"); |
|
|
441 | } catch (txtprt_i_exception & e) { |
|
|
442 | cout << "ERR: " << e.msg << endl; |
|
|
443 | } |
|
|
444 | e->show (); |
|
|
445 | |
|
|
446 | logo = 0; |
433 | logo = 0; |
447 | slowly = 0; |
434 | slowly = 0; |
448 | numtests = 1; |
435 | numtests = 1; |
449 | for (i = 1; argv[i]; ++i) |
436 | for (i = 1; argv[i]; ++i) |
450 | { |
437 | { |
… | |
… | |
478 | ("Usage: %s [-twice] [-logo] [-slow] [-bpp n] [-gamma n] [-noframe] [-fsaa]\n", |
465 | ("Usage: %s [-twice] [-logo] [-slow] [-bpp n] [-gamma n] [-noframe] [-fsaa]\n", |
479 | argv[0]); |
466 | argv[0]); |
480 | exit (0); |
467 | exit (0); |
481 | } |
468 | } |
482 | } |
469 | } |
|
|
470 | |
483 | for (i = 0; i < numtests; ++i) |
471 | for (i = 0; i < numtests; ++i) |
484 | { |
|
|
485 | RunGLTest (argc, argv, logo, slowly, bpp, gamma, noframe, fsaa); |
472 | RunGLTest (argc, argv, logo, slowly, bpp, gamma, noframe, fsaa); |
486 | } |
473 | |
487 | return 0; |
474 | return 0; |
488 | } |
475 | } |