Files Classes Functions Hierarchy
00001 #include <cassert> 00002 #include <iostream> 00003 #include <vector> 00004 00005 #include <GL/glut.h> 00006 #include <GL/gl.h> 00007 00008 using namespace std; 00009 00010 #include <zpr.h> 00011 00012 #include <graphmisc.h> 00013 00014 #include <gobj.h> 00015 //#include <displaypoints.h> 00016 00017 #include <print.h> 00018 00019 00020 #include <test06.h> 00021 00022 00023 typedef point3<double> pt3; 00024 00025 00026 test06::test06 00027 ( 00028 int & argc, 00029 char** & argv, 00030 uintc mode, 00031 uintc x, 00032 uintc y, 00033 string const & title 00034 ) 00035 : myglutgui(argc,argv,mode,x,y,title) 00036 { 00037 switchContainer = new gobjSwitchContainer(); 00038 00039 globalSet(); 00040 } 00041 00042 void test06::display() 00043 { 00044 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); 00045 00046 xGraphics.draw(); 00047 00048 //cout << "drawing" << endl; 00049 //cout << SHOW(xGraphics.v.size()) << endl; 00050 00051 glerrordisplay(); 00052 glutSwapBuffers(); 00053 } 00054 00055 void test06::f1() 00056 { 00057 cout << endl; 00058 cout << "Keyboard Commands" << endl; 00059 cout << "s - toggles the sphere" << endl; 00060 cout << "c - toggles the cube" << endl; 00061 cout << "w - toggles the cone" << endl; 00062 cout << "u - toggle the icosahedron" << endl; 00063 cout << "f - sets full screen mode" << endl; 00064 00065 xGraphics.push_back( new gobjglColor3f(1.0,0.0,0.0) ); 00066 gobjQuadric * q = new gobjQuadric(); 00067 q->radius=0.5; 00068 q->slices=20; 00069 q->loops=6; 00070 gobjMySphereDraw * s = new gobjMySphereDraw(0.0,0.0,0.0,q); 00071 00072 switchContainer->push_back(q,false); 00073 switchContainer->push_back(s,true); 00074 00075 00076 gobjglutSolidCube * cub = new gobjglutSolidCube((GLdouble)0.5); 00077 switchContainer->push_back(cub,true); 00078 00079 gobjglutSolidCone * con = 00080 new gobjglutSolidCone(.2,.3,10,10); 00081 switchContainer->push_back(con,true); 00082 00083 gobjContainer * d1 = new gobjContainer(); 00084 d1->push_back( new gobjglColor3f(1.0,1.0,0.0) ); 00085 d1->push_back( new gobjglPushMatrix() ); 00086 d1->push_back( new gobjglTranslatef(0.5,0.0,0.0) ); 00087 d1->push_back( new gobjglutSolidIcosahedron() ); 00088 d1->push_back( new gobjglPopMatrix() ); 00089 switchContainer->push_back(d1,true); 00090 00091 xGraphics.push_back(switchContainer); 00092 00093 } 00094 00095 void test06::keyboard(unsigned char key, int x, int y) 00096 { 00097 switch (key) 00098 { 00099 case 27: 00100 exit(0); 00101 break; 00102 00103 case 's': 00104 switchContainer->v[1]->toggle(); 00105 break; 00106 00107 case 'c': 00108 switchContainer->v[2]->toggle(); 00109 break; 00110 00111 case 'w': 00112 switchContainer->v[3]->toggle(); 00113 break; 00114 00115 case 'u': 00116 switchContainer->v[4]->toggle(); 00117 break; 00118 00119 00120 case 'f': 00121 glutFullScreen(); 00122 break; 00123 00124 00125 00126 } 00127 00128 glutPostRedisplay(); 00129 } 00130 00131 00132 00133 00134 00135 00136 void test06::eval() 00137 { 00138 OpenGLinitialisation(); 00139 00140 glEnable(GL_DEPTH_TEST); 00141 glEnable(GL_CULL_FACE); 00142 00143 //zpr::init(); 00144 00145 xGraphics.set(); 00146 00147 f1(); 00148 00149 glutPostRedisplay(); 00150 00151 } 00152
1.5.8