X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=scene.c;h=638683e95c05a4d7fb817c282d537057b32aefac;hb=a94c1e2ec02ba03c8f7c4dee751f2eded3203b8f;hp=6c9540ae85e4a69cb87c5da9cdc8285d6845c088;hpb=59ab0befd5f3d6ea6a2b72aeeb045ab93103995a;p=atyndall%2Fcits2231.git diff --git a/scene.c b/scene.c index 6c9540a..638683e 100644 --- a/scene.c +++ b/scene.c @@ -603,16 +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); - glMatrixMode(GL_MODELVIEW); -} - /** * Main function @@ -635,15 +625,18 @@ 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 - glClearColor(0.0f, 0.0f, 0.0f, 0.0f); // Black Background - glClearDepth(1.0f); // Depth Buffer Setup - glEnable(GL_DEPTH_TEST); // Enables Depth Testing - glDepthFunc(GL_LEQUAL); // the type + //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 + //glDepthFunc(GL_LEQUAL); // the type // glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST); // Really Nice Perspective Calculations @@ -653,9 +646,15 @@ int main(int argc, char **argv) { 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); @@ -664,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);