volmetrics
diff src/main.cc @ 11:c5af275b6a60
fixed normals
author | Eleni Maria Stea <elene.mst@gmail.com> |
---|---|
date | Mon, 27 Jan 2014 01:22:02 +0200 |
parents | 8ffa6d61eb56 |
children | 1272e3335608 |
line diff
1.1 --- a/src/main.cc Sun Jan 26 23:18:13 2014 +0200 1.2 +++ b/src/main.cc Mon Jan 27 01:22:02 2014 +0200 1.3 @@ -23,9 +23,7 @@ 1.4 static float cam_phi, cam_theta, cam_dist = 6; 1.5 static std::vector<bool> key_state(256); 1.6 1.7 -///////////////////////////// 1.8 -// debug TODO remove 1.9 -//////////////////////////// 1.10 +static const char *vol_fname = "data/test1.vol"; 1.11 1.12 static Volume *vol; 1.13 static Mesh *mesh; 1.14 @@ -40,9 +38,10 @@ 1.15 { 1.16 glutInit(&argc, argv); 1.17 glutInitWindowSize(512, 512); 1.18 - glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE); 1.19 + glutInitDisplayMode(GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE); 1.20 1.21 - //TODO parse arguments 1.22 + if(argv[1]) 1.23 + vol_fname = argv[1]; 1.24 1.25 glutCreateWindow("My Colonoscopie OEO!"); 1.26 1.27 @@ -67,9 +66,16 @@ 1.28 1.29 static bool init() 1.30 { 1.31 + glEnable(GL_DEPTH_TEST); 1.32 + glEnable(GL_NORMALIZE); 1.33 + 1.34 + glEnable(GL_LIGHTING); //TODO: shaders 1.35 + glEnable(GL_LIGHT0); 1.36 + glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, 1); 1.37 + 1.38 vol = new Volume; 1.39 - if(!vol->load("data/test1.vol")) { 1.40 - fprintf(stderr, "Failed to load test1.vol"); 1.41 + if(!vol->load(vol_fname)) { 1.42 + fprintf(stderr, "Failed to load %s", vol_fname); 1.43 return false; 1.44 } 1.45 mesh = new Mesh; 1.46 @@ -188,7 +194,6 @@ 1.47 case 'w': 1.48 { 1.49 static bool wire; 1.50 - 1.51 wire = !wire; 1.52 glPolygonMode(GL_FRONT_AND_BACK, wire ? GL_LINE : GL_FILL); 1.53 }