… | |
… | |
332 | |
332 | |
333 | glShadeModel (GL_SMOOTH); |
333 | glShadeModel (GL_SMOOTH); |
334 | |
334 | |
335 | glEnable (GL_LIGHTING); |
335 | glEnable (GL_LIGHTING); |
336 | |
336 | |
337 | GLfloat lightc[4] = { 1, 0.1, 0.1, 1 }; |
337 | //GLfloat lightc[4] = { 1, 0.1, 0.1, 1 }; |
338 | //glLightf (GL_LIGHT0, GL_QUADRATIC_ATTENUATION); |
338 | //glLightf (GL_LIGHT0, GL_QUADRATIC_ATTENUATION); |
339 | glLightfv (GL_LIGHT0, GL_DIFFUSE, lightc); |
339 | //glLightfv (GL_LIGHT0, GL_DIFFUSE, lightc); |
340 | glEnable (GL_LIGHT0); |
340 | glEnable (GL_LIGHT0); |
341 | glEnable (GL_COLOR_MATERIAL); |
341 | glEnable (GL_COLOR_MATERIAL); |
342 | |
342 | |
343 | /* Loop until done. */ |
343 | /* Loop until done. */ |
344 | start_time = SDL_GetTicks (); |
344 | start_time = SDL_GetTicks (); |
… | |
… | |
366 | v.d.x = cos (ry); |
366 | v.d.x = cos (ry); |
367 | v.d.z = sin (ry); |
367 | v.d.z = sin (ry); |
368 | #endif |
368 | #endif |
369 | |
369 | |
370 | draw_context c; |
370 | draw_context c; |
|
|
371 | c.mode = draw_context::LIGHTED; |
371 | camera.draw (c); |
372 | camera.draw (c); |
372 | |
373 | |
373 | SDL_GL_SwapBuffers (); |
374 | SDL_GL_SwapBuffers (); |
374 | |
375 | |
375 | /* Check for error conditions. */ |
376 | /* Check for error conditions. */ |
… | |
… | |
385 | fprintf (stderr, "testgl: SDL error '%s'\n", sdl_error); |
386 | fprintf (stderr, "testgl: SDL error '%s'\n", sdl_error); |
386 | SDL_ClearError (); |
387 | SDL_ClearError (); |
387 | } |
388 | } |
388 | |
389 | |
389 | /* Allow the user to see what's happening */ |
390 | /* Allow the user to see what's happening */ |
390 | SDL_Delay (20); |
391 | //SDL_Delay (20); |
391 | |
392 | |
392 | /* Check if there's a pending event. */ |
393 | /* Check if there's a pending event. */ |
393 | while (SDL_PollEvent (&event)) |
394 | while (SDL_PollEvent (&event)) |
394 | { |
395 | { |
395 | done = HandleEvent (&event); |
396 | done = HandleEvent (&event); |