Files Classes Functions Hierarchy
00001 00002 #include <visenv.h> 00003 #include <visoperator.h> 00004 #include <zpr.h> 00005 00006 visenv::visenv(int argc, char** argv, boolc graphics) 00007 { 00008 defaultsettings(); 00009 00010 if (graphics) 00011 defaultgraphics(argc,argv); 00012 } 00013 00014 00015 void visenv::keyboard 00016 ( 00017 unsigned char key, 00018 int x, 00019 int y 00020 ) 00021 { 00022 switch (key) 00023 { 00024 case 27: exit(0); break; 00025 00026 } 00027 } 00028 00029 void visenv::defaultgraphics(int argc, char** argv) 00030 { 00031 glutInit(&argc,argv); 00032 glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH); 00033 glutInitWindowSize(800,600); 00034 glutCreateWindow(""); 00035 glutDisplayFunc(display); 00036 glutKeyboardFunc(keyboard); 00037 00038 OpenGLinitialisation(); 00039 glEnable(GL_CULL_FACE); 00040 glEnable(GL_NORMALIZE); 00041 00042 xGraphics.set(); 00043 00044 /* 00045 sphere01 = new gobjQuadric(); 00046 00047 sphere01->radius = 0.05; 00048 sphere01->slices = 30; 00049 sphere01->loops = 7; 00050 */ 00051 00052 gobjpush(new myaxes(1.0)); 00053 00054 // pointdisplay=true; 00055 } 00056 00057 void visenv::display() 00058 { 00059 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); 00060 00061 gobj::global->draw(); 00062 glerrordisplay(); 00063 00064 glutSwapBuffers(); 00065 } 00066 00067 00068 void visenv::defaultsettings() 00069 { 00070 visoperator::set(*this); 00071 00072 pi.clear(); 00073 pi.push_back(point3<double>()); 00074 00075 //pointdisplay=false; 00076 } 00077 00078 /* 00079 void visenv::piaddpoint(bool& res, stringc & s) 00080 { 00081 //cout << SHOW(s) << endl; 00082 pt3 p; 00083 p.serializeInverse(s); 00084 //cout << SHOW(p) << endl; 00085 res=true; 00086 pi.push_back(p); 00087 //pointdisplay=true; 00088 if (pointdisplay) 00089 { 00090 gobjpush( new gobjglColor3f(1.0,0.0,0.0) ); 00091 gobjpush 00092 ( 00093 new gobjMySphereDraw(p,sphere01) 00094 // new gobjMySphereDraw(p.x,p.y,p.z,sphere01) 00095 ); 00096 } 00097 00098 } 00099 */ 00100 00101 void visenv::graphicsloop() 00102 { 00103 zpr zz; 00104 zz.update(); 00105 00106 glutMainLoop(); 00107 } 00108
1.5.8