proj home

Files   Classes   Functions   Hierarchy  

graphmisctest.cpp

Go to the documentation of this file.
00001 #include <iostream>
00002 #include <vector>
00003 #include <cstdlib>
00004 using namespace std;
00005 
00006 
00007 #include <graphmisc.h>
00008 #include <graphmisctest.h>
00009 #include <print.h>
00010 #include <zpr.h>
00011 
00012 void graphmisctest::keyboard01
00013 (
00014   unsigned char key, 
00015   int x, 
00016   int y
00017 )
00018 {
00019   switch (key)
00020   {
00021     case 27:
00022       exit(0);
00023       break;
00024   }
00025 }
00026 
00027 void graphmisctest::display01()
00028 { 
00029   glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
00030 
00031   gobj::global->draw();
00032 
00033 
00034   glerrordisplay();
00035   
00036   glutSwapBuffers();
00037 }
00038 
00039 
00040 //<TODO> Review this test!!!
00041 void graphmisctest::test001()
00042 {
00043   double imax = 9;
00044   double dx = 1/(imax-1);
00045 
00046   colorfunction f;
00047 
00048   point3<double> w;
00049   double z;
00050 
00051   for ( unsigned int i=0; i<imax; ++i)
00052   {
00053     cout << i*dx << endl;
00054     z = i*dx;
00055     f(w,z);
00056     cout << w << endl;
00057   }
00058 
00059   cout << endl << endl << "Verifying Color function" << endl;
00060   double vz[9] = { 0.0, 0.125, 0.25, 0.375, 0.5, 0.625,0.75,0.875,1.0 }; 
00061   vector<double> v(vz,vz+9);
00062   for (unsigned int i=0; i<v.size(); ++i)
00063   {
00064     f(w,v[i]);
00065     cout << SHOW(v[i]) << " " << w << endl;
00066   }
00067 }
00068 
00069 void graphmisctest::test002(int argc, char** argv)
00070 {
00071   glutInit(&argc,argv);
00072   glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH);
00073   glutInitWindowSize(800,600);
00074   glutCreateWindow("");
00075   glutDisplayFunc(display01);
00076   glutKeyboardFunc(keyboard01);
00077 
00078   OpenGLinitialisation();
00079 
00080   glEnable(GL_DEPTH_TEST);
00081   glEnable(GL_CULL_FACE);
00082   glEnable(GL_NORMALIZE);
00083 
00084   xGraphics.set();
00085 
00086   gobjpush(new gobjglColor3ub(34,139,34));
00087   //gridsquare * gs = new gridsquare(1,0x0101,5,5,1.0,1.0);
00088   gridsquare * gs = new gridsquare(1,0xaaaa,5,5,1.0,1.0);
00089   
00090   gobjpush(gs);
00091 
00092   zpr zz;
00093   zz.update();
00094   glutMainLoop();
00095 }
00096 
00097 
00098 
00099 

Generated on Fri Mar 4 00:49:27 2011 for Chelton Evans Source by  doxygen 1.5.8