proj home

Files   Classes   Functions   Hierarchy  

pointsurfacetest.cpp

Go to the documentation of this file.
00001 
00002 #include <zpr.h>
00003 #include <graphmisc.h>
00004 
00005 #include <pointsurfacetest.h>
00006 
00007 
00008 #include <pointsurface.h>
00009 
00010 
00011 void pointsurfacetestdisplay01()
00012 {
00013   glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
00014 
00015   gobj::global->draw();
00016 
00017   glerrordisplay();
00018   
00019   glutSwapBuffers();
00020 }
00021 
00022 void pointsurfacetestkeyboard01(unsigned char key, int x, int y)
00023 {
00024   switch (key)
00025   {
00026     case 27:
00027       exit(0);
00028       break;
00029   }
00030 }
00031 
00032 
00033 class pointsurfacetestOval 
00034 {
00035 public:
00036 
00037   void operator()
00038   (
00039     bool & accept,
00040     double & x,
00041     double & y,
00042     double & z,
00043     doublec u,
00044     doublec v
00045   )
00046   {
00047     double u2(u*2.0-1.0);
00048     double v2(v*2.0-1.0);
00049     if (u2*u2+v2*v2>1.0)
00050     {
00051       accept=false;
00052       return;
00053     }
00054    
00055     x=u2*3.0;
00056     y=0.0;
00057     z=v2*6.0;
00058 
00059 //cout << SHOW(x) << " " << SHOW(y) << " " SHOW(z) << endl;
00060 
00061     accept=true;
00062   }  
00063 };
00064 
00065 
00066 int pointsurfacetest::test01(int argc, char** argv)
00067 {
00068   glutInit(&argc,argv);
00069   glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH);
00070   glutInitWindowSize(800,600);
00071   glutCreateWindow("");
00072   glutDisplayFunc(pointsurfacetestdisplay01);
00073   glutKeyboardFunc(pointsurfacetestkeyboard01);
00074 
00075   OpenGLinitialisation();
00076 
00077   glEnable(GL_DEPTH_TEST);
00078   glEnable(GL_CULL_FACE);
00079   glEnable(GL_NORMALIZE);
00080 
00081   xGraphics.set();
00082 
00083   pointsurfacetestOval f;
00084 
00085   pointsurface<> ps(2000);
00086   ps.pre.push(new gobjglColor3f(1.0,0.0,0.0) );
00087 
00088   ps.addsurface2D(f);
00089 
00090   gobjpush(&ps);
00091 
00093   zpr zz;
00094 
00095   glutMainLoop();
00096 
00097   return 0;
00098 }
00099   
00100 
00101 int pointsurfacetest::test02(int argc, char** argv)
00102 {
00103   glutInit(&argc,argv);
00104   glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH);
00105   glutInitWindowSize(800,600);
00106   glutCreateWindow("");
00107   glutDisplayFunc(pointsurfacetestdisplay01);
00108   glutKeyboardFunc(pointsurfacetestkeyboard01);
00109 
00110   OpenGLinitialisation();
00111 
00112   glEnable(GL_DEPTH_TEST);
00113   glEnable(GL_CULL_FACE);
00114   glEnable(GL_NORMALIZE);
00115 
00117   zpr zz;
00118 
00119   xGraphics.set();
00120 
00121   pointsurfaceSphere f;
00122 
00123   pointsurface<> ps(2000);
00124   ps.pre.push(new gobjglColor3ub(184,134,11) );
00125 
00126 /*
00127 
00128   pointsurfacetestSphere f;
00129 
00130   pointsurface<> ps(2000);
00131   ps.pre.push(new gobjglColor3f(1.0,0.0,0.0) );
00132 */
00133 
00134   ps.addsurface3D(f);
00135 
00136   gobjpush(&ps);
00137 
00138   glutMainLoop();
00139 
00140   return 0;
00141 }
00142 
00143 
00144 int pointsurfacetest::test03(int argc, char** argv)
00145 {
00146   glutInit(&argc,argv);
00147   glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH);
00148   glutInitWindowSize(800,600);
00149   glutCreateWindow("");
00150   glutDisplayFunc(pointsurfacetestdisplay01);
00151   glutKeyboardFunc(pointsurfacetestkeyboard01);
00152 
00153   OpenGLinitialisation();
00154 
00155   glEnable(GL_DEPTH_TEST);
00156   glEnable(GL_CULL_FACE);
00157   glEnable(GL_NORMALIZE);
00158 
00160   zpr zz;
00161 
00162   xGraphics.set();
00163 
00164   pointsurfaceParallelogram f
00165   ( 
00166     point3<double>(0.1,0.1,0.0),
00167     point3<double>(0.3,0.1,0.0),
00168     point3<double>(0.0,0.0,0.2)
00169   );
00170 
00171   pointsurface<> ps(2000);
00172   ps.pre.push(new gobjglColor3ub(184,134,11) );
00173 
00174   ps.addsurface2D(f);
00175 
00176   gobjpush(&ps);
00177 
00178   glutMainLoop();
00179 
00180   return 0;
00181 }
00182 

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