… | |
… | |
172 | int rgb_size[3]; |
172 | int rgb_size[3]; |
173 | int w = 640; |
173 | int w = 640; |
174 | int h = 480; |
174 | int h = 480; |
175 | int done = 0; |
175 | int done = 0; |
176 | int frames; |
176 | int frames; |
177 | Uint32 start_time, this_time; |
|
|
178 | Uint32 video_flags; |
177 | Uint32 video_flags; |
179 | int value; |
178 | int value; |
180 | GLenum gl_error; |
179 | GLenum gl_error; |
181 | |
180 | |
182 | if (SDL_Init (SDL_INIT_VIDEO) < 0) |
181 | if (SDL_Init (SDL_INIT_VIDEO) < 0) |
… | |
… | |
335 | init_shaders (); |
334 | init_shaders (); |
336 | |
335 | |
337 | osama_material osa_mat; |
336 | osama_material osa_mat; |
338 | |
337 | |
339 | /* Loop until done. */ |
338 | /* Loop until done. */ |
340 | start_time = SDL_GetTicks (); |
|
|
341 | frames = 0; |
339 | frames = 0; |
342 | |
340 | |
343 | while (!done) |
341 | while (!done) |
344 | { |
342 | { |
345 | char *sdl_error; |
343 | char *sdl_error; |
… | |
… | |
392 | while (SDL_PollEvent (&event)) |
390 | while (SDL_PollEvent (&event)) |
393 | done = HandleEvent (&event); |
391 | done = HandleEvent (&event); |
394 | |
392 | |
395 | |
393 | |
396 | ++frames; |
394 | ++frames; |
397 | } |
|
|
398 | |
|
|
399 | /* Print out the frames per second */ |
|
|
400 | this_time = SDL_GetTicks (); |
|
|
401 | if (this_time != start_time) |
|
|
402 | { |
|
|
403 | printf ("%2.2f FPS\n", |
|
|
404 | ((float) frames / (this_time - start_time)) * 1000.0); |
|
|
405 | } |
395 | } |
406 | |
396 | |
407 | if (global_image) |
397 | if (global_image) |
408 | { |
398 | { |
409 | SDL_FreeSurface (global_image); |
399 | SDL_FreeSurface (global_image); |