ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/libgender/test.C
(Generate patch)

Comparing libgender/test.C (file contents):
Revision 1.68 by root, Thu Oct 21 21:20:09 2004 UTC vs.
Revision 1.71 by root, Fri Oct 29 15:58:50 2004 UTC

12static GLuint global_texture = 0; 12static GLuint global_texture = 0;
13 13
14#include "util.h" 14#include "util.h"
15#include "entity.h" 15#include "entity.h"
16#include "txtprt_import.h" 16#include "txtprt_import.h"
17
18#include "shader.h"
17 19
18/**********************************************************************/ 20/**********************************************************************/
19 21
20view camera; 22view camera;
21vec3 camera_velocity; 23vec3 camera_velocity;
243 } 245 }
244 246
245 SDL_GL_SetAttribute (SDL_GL_RED_SIZE, rgb_size[0]); 247 SDL_GL_SetAttribute (SDL_GL_RED_SIZE, rgb_size[0]);
246 SDL_GL_SetAttribute (SDL_GL_GREEN_SIZE, rgb_size[1]); 248 SDL_GL_SetAttribute (SDL_GL_GREEN_SIZE, rgb_size[1]);
247 SDL_GL_SetAttribute (SDL_GL_BLUE_SIZE, rgb_size[2]); 249 SDL_GL_SetAttribute (SDL_GL_BLUE_SIZE, rgb_size[2]);
248 SDL_GL_SetAttribute (SDL_GL_DEPTH_SIZE, 16); 250 SDL_GL_SetAttribute (SDL_GL_DEPTH_SIZE, 24);
249 SDL_GL_SetAttribute (SDL_GL_DOUBLEBUFFER, 1); 251 SDL_GL_SetAttribute (SDL_GL_DOUBLEBUFFER, 1);
250 252
251 if (fsaa) 253 if (fsaa)
252 { 254 {
253 SDL_GL_SetAttribute (SDL_GL_MULTISAMPLEBUFFERS, 1); 255 SDL_GL_SetAttribute (SDL_GL_MULTISAMPLEBUFFERS, 1);
259 fprintf (stderr, "Couldn't set GL mode: %s\n", SDL_GetError ()); 261 fprintf (stderr, "Couldn't set GL mode: %s\n", SDL_GetError ());
260 SDL_Quit (); 262 SDL_Quit ();
261 exit (1); 263 exit (1);
262 } 264 }
263 265
264 printf ("Screen BPP: %d\n", SDL_GetVideoSurface ()->format->BitsPerPixel); 266 //printf ("Screen BPP: %d\n", SDL_GetVideoSurface ()->format->BitsPerPixel);
265 printf ("\n"); 267 //printf ("\n");
266 printf ("Vendor : %s\n", glGetString (GL_VENDOR)); 268 //printf ("Vendor : %s\n", glGetString (GL_VENDOR));
267 printf ("Renderer : %s\n", glGetString (GL_RENDERER)); 269 //printf ("Renderer : %s\n", glGetString (GL_RENDERER));
268 printf ("Version : %s\n", glGetString (GL_VERSION)); 270 //printf ("Version : %s\n", glGetString (GL_VERSION));
269 printf ("Extensions : %s\n", glGetString (GL_EXTENSIONS)); 271 //printf ("Extensions : %s\n", glGetString (GL_EXTENSIONS));
270 printf ("\n"); 272 printf ("\n");
271 273
272 SDL_GL_GetAttribute (SDL_GL_RED_SIZE, &value); 274 SDL_GL_GetAttribute (SDL_GL_RED_SIZE, &value);
273 printf ("SDL_GL_RED_SIZE: requested %d, got %d\n", rgb_size[0], value); 275 printf ("SDL_GL_RED_SIZE: requested %d, got %d\n", rgb_size[0], value);
274 SDL_GL_GetAttribute (SDL_GL_GREEN_SIZE, &value); 276 SDL_GL_GetAttribute (SDL_GL_GREEN_SIZE, &value);
297 SDL_SetGamma (gamma, gamma, gamma); 299 SDL_SetGamma (gamma, gamma, gamma);
298 300
299 entity *planet = new entity (new geometry_sphere (10)); 301 entity *planet = new entity (new geometry_sphere (10));
300 planet->move (vec3 (0, 0, -20)); 302 planet->move (vec3 (0, 0, -20));
301 planet->show (); 303 planet->show ();
304
305 shader::debdebdebdebug ();//D
302 306
303#if 1 307#if 1
304 for (int i = 0; i < 20; i++) 308 for (int i = 0; i < 20; i++)
305 { 309 {
306 // load a entity 310 // load a entity
348 352
349 glEnable (GL_CULL_FACE); 353 glEnable (GL_CULL_FACE);
350 glDisable (GL_ALPHA_TEST); 354 glDisable (GL_ALPHA_TEST);
351 glDisable (GL_BLEND); 355 glDisable (GL_BLEND);
352 356
353 init_shaders (); 357 test_material test_mat;
354
355 osama_material osa_mat;
356 358
357 /* Loop until done. */ 359 /* Loop until done. */
358 frames = 0; 360 frames = 0;
359 361
360 while (!done) 362 while (!done)
372 camera.u = cross (camera.d, right); 374 camera.u = cross (camera.d, right);
373 375
374 camera.p = camera.p - camera.d * (camera_velocity_factor * timer.diff) * camera_velocity.z; 376 camera.p = camera.p - camera.d * (camera_velocity_factor * timer.diff) * camera_velocity.z;
375 camera.p = camera.p - camera.u * (camera_velocity_factor * timer.diff) * camera_velocity.y; 377 camera.p = camera.p - camera.u * (camera_velocity_factor * timer.diff) * camera_velocity.y;
376 378
377 osa_mat.begin (); 379 test_mat.enable ();
378 380
379 camera.begin (); 381 camera.begin ();
380 camera.render (view::DEPTH); 382 camera.render (view::DEPTH);
381 camera.render (view::POSTDEPTH); 383 camera.render (view::POSTDEPTH);
382 camera.render (view::LIGHTED); 384 camera.render (view::LIGHTED);
383 camera.end (); 385 camera.end ();
384 386
385 SDL_GL_SwapBuffers (); 387 SDL_GL_SwapBuffers ();
386 timer.frame (); 388 timer.frame ();
387 389
388 osa_mat.end (); 390 test_mat.disable ();
389 391
390#if 0 392#if 0
391 /* Check for error conditions. */ 393 /* Check for error conditions. */
392 gl_error = glGetError (); 394 gl_error = glGetError ();
393 395
437 int slowly; 439 int slowly;
438 float gamma = 0.0; 440 float gamma = 0.0;
439 int noframe = 0; 441 int noframe = 0;
440 int fsaa = 0; 442 int fsaa = 0;
441 443
442 shader::debdebdebdebug ();//D
443
444 logo = 0; 444 logo = 0;
445 slowly = 0; 445 slowly = 0;
446 numtests = 1; 446 numtests = 1;
447 for (i = 1; argv[i]; ++i) 447 for (i = 1; argv[i]; ++i)
448 { 448 {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines