… | |
… | |
161 | int done = 0; |
161 | int done = 0; |
162 | int frames; |
162 | int frames; |
163 | Uint32 start_time, this_time; |
163 | Uint32 start_time, this_time; |
164 | Uint32 video_flags; |
164 | Uint32 video_flags; |
165 | int value; |
165 | int value; |
|
|
166 | GLenum gl_error; |
166 | |
167 | |
167 | if (SDL_Init (SDL_INIT_VIDEO) < 0) |
168 | if (SDL_Init (SDL_INIT_VIDEO) < 0) |
168 | { |
169 | { |
169 | fprintf (stderr, "Couldn't initialize SDL: %s\n", SDL_GetError ()); |
170 | fprintf (stderr, "Couldn't initialize SDL: %s\n", SDL_GetError ()); |
170 | exit (1); |
171 | exit (1); |
… | |
… | |
282 | entity_transform *f = new entity_transform; |
283 | entity_transform *f = new entity_transform; |
283 | f->set (e); |
284 | f->set (e); |
284 | f->update (matrix::translation (vec3 (i*5, -3, -i*10))); |
285 | f->update (matrix::translation (vec3 (i*5, -3, -i*10))); |
285 | f->show (); |
286 | f->show (); |
286 | } |
287 | } |
287 | draw_some_random_funky_floor_dance_music (10, -500, -10, -1000); |
288 | draw_some_random_funky_floor_dance_music (10, -500, -10, -1000); |
288 | camera.orig.x = camera.orig.y = camera.orig.z = 0; |
289 | camera.orig.x = camera.orig.y = camera.orig.z = 0; |
289 | camera.p = point (0, 0, 10); |
290 | camera.p = point (0, 0, 10); |
290 | camera.d = vec3 (0, 0, -1); |
291 | camera.d = vec3 (0, 0, -1); |
291 | camera.u = vec3 (0, 1, 0); |
292 | camera.u = vec3 (0, 1, 0); |
292 | camera.w = w; camera.h = h; |
293 | camera.w = w; camera.h = h; |
… | |
… | |
341 | start_time = SDL_GetTicks (); |
342 | start_time = SDL_GetTicks (); |
342 | frames = 0; |
343 | frames = 0; |
343 | |
344 | |
344 | while (!done) |
345 | while (!done) |
345 | { |
346 | { |
346 | GLenum gl_error; |
|
|
347 | char *sdl_error; |
347 | char *sdl_error; |
348 | SDL_Event event; |
348 | SDL_Event event; |
349 | |
349 | |
350 | camera.p.x += camera_velocity_factor * camera_velocity.x * timer.diff; |
350 | camera.p.x += camera_velocity_factor * camera_velocity.x * timer.diff; |
351 | camera.p.y += camera_velocity_factor * camera_velocity.y * timer.diff; |
351 | camera.p.y += camera_velocity_factor * camera_velocity.y * timer.diff; |
… | |
… | |
377 | timer.frame (); |
377 | timer.frame (); |
378 | |
378 | |
379 | /* Check for error conditions. */ |
379 | /* Check for error conditions. */ |
380 | gl_error = glGetError (); |
380 | gl_error = glGetError (); |
381 | |
381 | |
382 | if (gl_error != GL_NO_ERROR) |
|
|
383 | fprintf (stderr, "testgl: OpenGL error: %d\n", gl_error); |
382 | if (gl_error != GL_NO_ERROR) fprintf (stderr, "testgl: OpenGL error: %d\n", gl_error); |
384 | |
383 | |
385 | sdl_error = SDL_GetError (); |
384 | sdl_error = SDL_GetError (); |
386 | |
385 | |
387 | if (sdl_error[0] != '\0') |
386 | if (sdl_error[0] != '\0') |
388 | { |
387 | { |