From 1620327b0ca461adaf5f467e08b9b3c633761816 Mon Sep 17 00:00:00 2001 From: Ash Tyndall Date: Tue, 18 Oct 2011 11:43:58 +0800 Subject: [PATCH] --- scene.c | 39 +++++++++++++++------------------------ 1 file changed, 15 insertions(+), 24 deletions(-) diff --git a/scene.c b/scene.c index 23f37ed..349ccbf 100644 --- a/scene.c +++ b/scene.c @@ -603,24 +603,6 @@ void display() { glutSwapBuffers(); } -/** - * init function, sets OpenGL's starting state - */ -void init() { - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - // gluPerspective( 60, 1, 0.1, 1000.0); - gluPerspective( /* field of view in degree */ 40.0, - /* aspect ratio */ 1.0, - /* Z near */ 20.0, /* Z far */ 100.0); - glMatrixMode(GL_MODELVIEW); - gluLookAt(0.0, 8.0, 60.0, /* eye is at (0,8,60) */ - 0.0, 8.0, 0.0, /* center is at (0,8,0) */ - 0.0, 1.0, 0.); /* up is in postivie Y direction */ - - glMatrixMode(GL_MODELVIEW); -} - /** * Main function @@ -643,11 +625,14 @@ int main(int argc, char **argv) { glutInit(&argc, argv); - glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH); + //glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH); + + glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH | GLUT_STENCIL | GLUT_MULTISAMPLE); + glutInitWindowSize(500, 500); glutCreateWindow("Scene Editor"); - glShadeModel(GL_SMOOTH); // Enables Smooth Shading + /*glShadeModel(GL_SMOOTH); // Enables Smooth Shading glClearColor(0.0f, 0.0f, 0.0f, 0.0f); // Black Background glClearDepth(1.0f); // Depth Buffer Setup glEnable(GL_DEPTH_TEST); // Enables Depth Testing @@ -657,13 +642,19 @@ int main(int argc, char **argv) { glutReshapeFunc(windowReshape); glutDisplayFunc(display); - glutMouseFunc(mouse); + glutMouseFunc(mouse);*/ makeMenu(); - init(); + //init(); + + + glEnable(GL_CULL_FACE); + glEnable(GL_DEPTH_TEST); + glEnable(GL_TEXTURE_2D); + glLineWidth(3.0); - glMatrixMode(GL_PROJECTION); +glMatrixMode(GL_PROJECTION); gluPerspective( /* field of view in degree */ 40.0, /* aspect ratio */ 1.0, /* Z near */ 20.0, /* Z far */ 100.0); @@ -672,7 +663,7 @@ int main(int argc, char **argv) { 0.0, 8.0, 0.0, /* center is at (0,8,0) */ 0.0, 1.0, 0.); /* up is in postivie Y direction */ - glLightModeli(GL_LIGHT_MODEL_LOCAL_VIEWER, 1); + glLightModeli(GL_LIGHT_MODEL_LOCAL_VIEWER, 1); glLightfv(GL_LIGHT0, GL_DIFFUSE, lightColor); glLightf(GL_LIGHT0, GL_CONSTANT_ATTENUATION, 0.1); glLightf(GL_LIGHT0, GL_LINEAR_ATTENUATION, 0.05); -- 2.20.1