… | |
… | |
264 | } |
264 | } |
265 | |
265 | |
266 | SDL_GL_SetAttribute (SDL_GL_RED_SIZE, rgb_size[0]); |
266 | SDL_GL_SetAttribute (SDL_GL_RED_SIZE, rgb_size[0]); |
267 | SDL_GL_SetAttribute (SDL_GL_GREEN_SIZE, rgb_size[1]); |
267 | SDL_GL_SetAttribute (SDL_GL_GREEN_SIZE, rgb_size[1]); |
268 | SDL_GL_SetAttribute (SDL_GL_BLUE_SIZE, rgb_size[2]); |
268 | SDL_GL_SetAttribute (SDL_GL_BLUE_SIZE, rgb_size[2]); |
|
|
269 | SDL_GL_SetAttribute (SDL_GL_ALPHA_SIZE, 0); |
269 | SDL_GL_SetAttribute (SDL_GL_DEPTH_SIZE, 24); |
270 | SDL_GL_SetAttribute (SDL_GL_DEPTH_SIZE, 24); |
270 | SDL_GL_SetAttribute (SDL_GL_DOUBLEBUFFER, 1); |
271 | SDL_GL_SetAttribute (SDL_GL_DOUBLEBUFFER, 1); |
271 | |
272 | |
272 | if (fsaa) |
273 | if (fsaa) |
273 | { |
274 | { |
… | |
… | |
294 | printf ("SDL_GL_RED_SIZE: requested %d, got %d\n", rgb_size[0], value); |
295 | printf ("SDL_GL_RED_SIZE: requested %d, got %d\n", rgb_size[0], value); |
295 | SDL_GL_GetAttribute (SDL_GL_GREEN_SIZE, &value); |
296 | SDL_GL_GetAttribute (SDL_GL_GREEN_SIZE, &value); |
296 | printf ("SDL_GL_GREEN_SIZE: requested %d, got %d\n", rgb_size[1], value); |
297 | printf ("SDL_GL_GREEN_SIZE: requested %d, got %d\n", rgb_size[1], value); |
297 | SDL_GL_GetAttribute (SDL_GL_BLUE_SIZE, &value); |
298 | SDL_GL_GetAttribute (SDL_GL_BLUE_SIZE, &value); |
298 | printf ("SDL_GL_BLUE_SIZE: requested %d, got %d\n", rgb_size[2], value); |
299 | printf ("SDL_GL_BLUE_SIZE: requested %d, got %d\n", rgb_size[2], value); |
|
|
300 | SDL_GL_GetAttribute (SDL_GL_ALPHA_SIZE, &value); |
|
|
301 | printf ("SDL_GL_ALPHA_SIZE: requested ?, got %d\n", value); |
299 | SDL_GL_GetAttribute (SDL_GL_DEPTH_SIZE, &value); |
302 | SDL_GL_GetAttribute (SDL_GL_DEPTH_SIZE, &value); |
300 | printf ("SDL_GL_DEPTH_SIZE: requested %d, got %d\n", bpp, value); |
303 | printf ("SDL_GL_DEPTH_SIZE: requested %d, got %d\n", bpp, value); |
301 | SDL_GL_GetAttribute (SDL_GL_DOUBLEBUFFER, &value); |
304 | SDL_GL_GetAttribute (SDL_GL_DOUBLEBUFFER, &value); |
302 | printf ("SDL_GL_DOUBLEBUFFER: requested 1, got %d\n", value); |
305 | printf ("SDL_GL_DOUBLEBUFFER: requested 1, got %d\n", value); |
303 | |
306 | |
… | |
… | |
316 | /* Set the gamma for the window */ |
319 | /* Set the gamma for the window */ |
317 | if (gamma != 0.0) |
320 | if (gamma != 0.0) |
318 | SDL_SetGamma (gamma, gamma, gamma); |
321 | SDL_SetGamma (gamma, gamma, gamma); |
319 | |
322 | |
320 | testmat = new test_material; |
323 | testmat = new test_material; |
321 | testmat2 = new test_material2; |
324 | testmat2 = new mat_gouraud_shaded (colour (1, 1, 0)); |
|
|
325 | testmat3 = new mat_timed (); |
|
|
326 | debugmat = new mat_debug (); |
322 | |
327 | |
323 | entity_moveable *planet = new entity_moveable (new geometry_sphere (testmat, 10)); |
328 | entity_moveable *planet = new entity_moveable (new geometry_sphere (testmat2, 10)); |
324 | planet->move (vec3 (0, 0, -20)); |
329 | planet->move (vec3 (0, 0, -20)); |
325 | planet->show (); |
330 | planet->show (); |
326 | |
331 | |
327 | planet->v = vec3 (10, 0, 0); |
332 | planet->v = vec3 (10, 0, 0); |
328 | moveables.push_back (planet); |
333 | moveables.push_back (planet); |
… | |
… | |
354 | //planet->move (vec3 (0, 0, -1.5e9)); |
359 | //planet->move (vec3 (0, 0, -1.5e9)); |
355 | //planet->show (); |
360 | //planet->show (); |
356 | } |
361 | } |
357 | |
362 | |
358 | { |
363 | { |
359 | entity *planet = new entity (new geometry_sphere (testmat, 4e15)); |
364 | entity *planet = new entity (new geometry_sphere (testmat3, 4e15)); |
360 | planet->move (vec3 (0, 0, 1e17)); |
365 | planet->move (vec3 (0, 0, 1e17)); |
361 | planet->show (); |
366 | planet->show (); |
362 | } |
367 | } |
363 | |
368 | |
364 | { |
369 | { |
… | |
… | |
413 | // mylight.radius = 100000; |
418 | // mylight.radius = 100000; |
414 | // mylight.c = colour (1., 1, 1, 1.); |
419 | // mylight.c = colour (1., 1, 1, 1.); |
415 | // mylight.intensity = 1.F; |
420 | // mylight.intensity = 1.F; |
416 | |
421 | |
417 | mylight2.radius = 100000; |
422 | mylight2.radius = 100000; |
418 | mylight2.c = colour (1., 1., 1., 1.); |
423 | mylight2.c = colour (0., 1., 1., 1.); |
419 | mylight2.intensity = 1.F; |
424 | mylight2.intensity = 1.F; |
420 | mylight2.orig.x = 0; mylight2.orig.y = 0; mylight2.orig.z = 0; |
425 | mylight2.orig.x = 0; mylight2.orig.y = 0; mylight2.orig.z = 0; |
421 | mylight2.p.x = 0; mylight2.p.y = 0; mylight2.p.z = 0; |
426 | mylight2.p.x = 0; mylight2.p.y = 0; mylight2.p.z = 0; |
422 | |
427 | |
423 | //pass_data pass_light (&mylight); |
428 | //pass_data pass_light (&mylight); |
… | |
… | |
442 | |
447 | |
443 | //mylight.orig = camera.orig; |
448 | //mylight.orig = camera.orig; |
444 | //mylight.p = camera.p; |
449 | //mylight.p = camera.p; |
445 | |
450 | |
446 | mylight2.orig = camera.orig; |
451 | mylight2.orig = camera.orig; |
447 | mylight2.p = vec3 (sin (timer.now / 2) * 100000, 1, cos (timer.now / 2) * 100000); |
452 | //mylight2.p = vec3 (sin (timer.now / 2) * 100000, 1, cos (timer.now / 2) * 100000); |
448 | |
453 | |
449 | //mylight.intensity = max (sinf (timer.now) + 1.2F, 0.2F); |
454 | //mylight.intensity = max (sinf (timer.now) + 1.2F, 0.2F); |
450 | |
455 | |
451 | camera.begin (); |
456 | camera.begin (); |
452 | camera.render (pass_depth); |
457 | camera.render (pass_depth); |