Files Classes Functions Hierarchy
00001 #include <cassert> 00002 #include <cstdlib> 00003 #include <iostream> 00004 #include <vector> 00005 using namespace std; 00006 00007 #include <GL/glut.h> 00008 #include <GL/gl.h> 00009 00010 #include <zpr.h> 00011 00012 #include <graphmisc.h> 00013 00014 #include <gobj.h> 00015 00016 #include <test07.h> 00017 00018 00019 00020 test07::test07 00021 ( 00022 int & argc, 00023 char** & argv, 00024 uintc mode, 00025 uintc x, 00026 uintc y, 00027 string const & title 00028 ) 00029 : myglutgui(argc,argv,mode,x,y,title), xGraphics(true) 00030 { 00031 globalSet(); 00032 } 00033 00034 void test07::display() 00035 { 00036 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); 00037 00038 xGraphics.draw(); 00039 00040 //cout << "drawing" << endl; 00041 //cout << SHOW(xGraphics.vg.size()) << endl; 00042 00043 glerrordisplay(); 00044 glutSwapBuffers(); 00045 } 00046 00047 void test07::keyboard(unsigned char key, int x, int y) 00048 { 00049 switch (key) 00050 { 00051 case 27: 00052 exit(0); 00053 break; 00054 00055 case 'i': 00056 cout << "Enter the inner radius: "; 00057 cin >> gtorus->innerRadius; 00058 xGraphics.nuke(); 00059 xGraphics.push( gcomp->displaylistcreatenew(1) ); 00060 break; 00061 00062 case 'r': 00063 cout << "Enter the number of rings: "; 00064 cin >> gtorus->rings; 00065 xGraphics.nuke(); 00066 xGraphics.push( gcomp->displaylistcreatenew(1) ); 00067 break; 00068 00069 00070 } 00071 00072 glutPostRedisplay(); 00073 } 00074 00075 00076 /* 00077 void test07::f1update(doublec r) 00078 { 00079 gcomp->nuke(); 00080 00081 gobjglGenLists* gl = new gobjglGenLists(); 00082 gcomp->push_back(gl); 00083 00084 glColor3f(1.0,0.0,0.0); 00085 00086 } 00087 */ 00088 00089 void test07::f1() 00090 { 00091 gcomp = new gobjContainer(true); 00092 00093 gtorus = new gobjglutWireTorus(0.2,0.4,6,3); 00094 gcomp->push(gtorus); 00095 00096 00097 /* 00098 xGraphics.push_back(gcomp); 00099 00100 */ 00101 00102 xGraphics.push( gcomp->displaylistcreatenew(1) ); 00103 00104 } 00105 00106 00107 void test07::eval() 00108 { 00109 OpenGLinitialisation(); 00110 00111 glEnable(GL_DEPTH_TEST); 00112 glEnable(GL_CULL_FACE); 00113 00114 //zpr::init(); 00115 00116 xGraphics.set(); 00117 00118 f1(); 00119 00120 glutPostRedisplay(); 00121 } 00122 00123 00124 00125 00126
1.5.8