proj home

Files   Classes   Functions   Hierarchy  

test05.cpp

Go to the documentation of this file.
00001 #include <cassert>
00002 #include <iostream>
00003 #include <vector>
00004 using namespace std;
00005 
00006 #include <GL/glut.h>
00007 #include <GL/gl.h>
00008 
00009 
00010 #include <pointsdisplay.h>
00011 #include <gobj.h>
00012 #include <graphmisc.h>
00013 #include <test05.h>
00014 #include <typedefs.h>
00015 #include <zpr.h>
00016 
00017 
00018 typedef point3<double> pt3;
00019 
00020 
00021 test05::test05
00022 (
00023   int & argc, 
00024   char** & argv,
00025   uintc mode,
00026   uintc x,
00027   uintc y,
00028   string const & title
00029 )
00030   : myglutgui(argc,argv,mode,x,y,title), xGraphics(true)
00031 {
00032   globalSet();
00033 }
00034 
00035 void test05::display()
00036 {
00037   glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
00038 
00039   xGraphics.draw();
00040 
00041 //cout << "drawing" << endl;
00042 //cout << SHOW(xGraphics.vg.size()) << endl;
00043 
00044   glerrordisplay();
00045   glutSwapBuffers();
00046 }
00047 
00048 void test05::f1()
00049 {
00050   xGraphics.push( new gobjglDisable(GL_LIGHTING) );
00051 
00052   
00053   vector< pt3 > v;
00054   v.push_back( pt3(0.2, 0.3, 0.5) );
00055   v.push_back( pt3(-0.5, 0.0, 0.2) );
00056   v.push_back( pt3(0.2, 0.7, 0.9) );
00057   v.push_back( pt3(0.0, -0.3, -0.5) );
00058 
00059   xGraphics.push( new gobjglColor3f(1.0,0.0,0.0) );
00060 
00061   pointsdisplay3D<pt3> dp(xGraphics,v);
00062 }
00063 
00064 void test05::f2()
00065 {
00066   xGraphics.push( new gobjglDisable(GL_LIGHTING) );
00067 
00068   xGraphics.push( new gobjMyBitmapCharacter
00069     ( string("hello"), pt3(.2, .3, .5) ) );
00070   xGraphics.push( new gobjMyBitmapCharacter
00071     ( string("a"), pt3(.1, .5, .8) ) );
00072   xGraphics.push( new gobjMyBitmapCharacter
00073     ( string("b"), pt3(.2, .3, .2) ) );
00074   xGraphics.push( new gobjMyBitmapCharacter
00075     ( string("c"), pt3(-0.2, .9, .0) ) );
00076 
00077 }
00078 
00079 void test05::testCircles()
00080 {
00081   cout << "Testing Circles" << endl;
00082   cout << "Test the simple default circle generation." << endl;
00083   gobjMyCircle * c=new gobjMyCircle();
00084   xGraphics.push( new gobjMyCircleDraw(point3<double>(0.0,0.0,0.0),*c) );
00085 
00086   cout << "Test arc generation." << endl;
00087   gobjMyCircle * c2=new gobjMyCircle(PI/2.0,1.5*PI);
00088   xGraphics.push( new gobjglColor3f(0.0,1.0,0.0) );
00089   xGraphics.push( new gobjMyCircleDraw(point3<double>(1.0,0.0,0.0),*c2) );
00090 }
00091 
00092 void test05::testMyArrow()
00093 {
00094   cout << "Testing gobjMyArrow" << endl;
00095 
00096   point3<double> p0(0.0,0.0,0.0);
00097   point3<double> p1(3.0,0.0,0.0);
00098   double delta=0.2;
00099   
00100   gobjMyArrow* arr = 
00101     new gobjMyArrow(p0,p1,0.2,0.2,delta);
00102 
00103   xGraphics.push( new gobjglColor3f(0.0,1.0,0.0) );
00104 
00105   xGraphics.push(arr);
00106 }
00107 
00108 void test05::eval()
00109 {
00110 /*
00111   glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH);
00112   glutInitWindowSize(800,600);
00113   glutCreateWindow("");
00114 
00115   glutDisplayFunc(myglutguidisplay);
00116   glutKeyboardFunc(myglutguikeyboard);
00117 */
00118 
00119   OpenGLinitialisation();
00120   
00121   glEnable(GL_DEPTH_TEST);
00122   glEnable(GL_CULL_FACE);
00123 
00124 
00125   
00126   xGraphics.set();
00127 
00128   f1();
00129   f2();
00130   testCircles();
00131   testMyArrow();
00132 
00133   glutPostRedisplay();
00134 
00135 }
00136 
00137 

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