Subversion Repositories gelsvn

Rev

Rev 357 | Rev 365 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 357 Rev 363
Line 50... Line 50...
50
 
50
 
51
namespace
51
namespace
52
{
52
{
53
	int win_size_x = 800;
53
	int win_size_x = 800;
54
	int win_size_y = 800;
54
	int win_size_y = 800;
-
 
55
	bool per_vertex_normals = 1;
-
 
56
	bool redo_display_list = 1;
55
	QuatTrackBall* ball;
57
	QuatTrackBall* ball;
56
	int spin_timer = 20;
58
	int spin_timer = 20;
57
	void spin(int x);
59
	void spin(int x);
58
	int main_window;
60
	int main_window;
59
	TriMesh mesh;
61
	TriMesh mesh;
Line 297... Line 299...
297
	glutPostRedisplay();
299
	glutPostRedisplay();
298
}
300
}
299
 
301
 
300
void display()
302
void display()
301
{
303
{
302
    static bool washere = false;
-
 
303
    static unsigned int l;
304
	static unsigned int l;
304
    if(!washere)
305
    if(redo_display_list)
305
    {
306
    {
306
        cout << "Creating display list" << endl;
307
        cout << "Creating display list" << endl;
307
        l = glGenLists(1);
308
        l = glGenLists(1);
308
        glNewList(l, GL_COMPILE);
309
        glNewList(l, GL_COMPILE);
309
        draw(mesh);
310
        draw(mesh, per_vertex_normals);
310
        glEndList();
311
        glEndList();
311
        washere = true;
312
        redo_display_list = false;
312
		glutTimerFunc(spin_timer, spin, 0);	
313
		glutTimerFunc(spin_timer, spin, 0);	
313
	}
314
	}
314
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
315
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
315
    glLoadIdentity();
316
    glLoadIdentity();
316
    ball->set_gl_modelview();
317
    ball->set_gl_modelview();
Line 322... Line 323...
322
{
323
{
323
    switch(key)
324
    switch(key)
324
    {
325
    {
325
		case '\033': exit(0); break;
326
		case '\033': exit(0); break;
326
		case 'w': toggle_wire(); break;
327
		case 'w': toggle_wire(); break;
-
 
328
		case 'f': per_vertex_normals = !per_vertex_normals; redo_display_list = true; break;
327
    }
329
    }
328
}
330
}
329
}
331
}
330
 
332
 
331
int main(int argc, char** argv)
333
int main(int argc, char** argv)