proj home

Files   Classes   Functions   Hierarchy  

pointgrid3Ddraw Class Reference

Draw the pointgrid3D ojbect. More...

#include <pointgrid3Ddraw.h>

Inheritance diagram for pointgrid3Ddraw:
Collaboration diagram for pointgrid3Ddraw:

List of all members.

Public Member Functions

 pointgrid3Ddraw (pointgrid3D const &pg_)
 Construct with point turned on.
 ~pointgrid3Ddraw ()
 Cleanup.
void update ()
 Update the graphics by writing to the graphics container.

Public Attributes

pointgrid3D const & pg
 The object being drawn.
gobjQuadricquadric
 The sphere at the points.
bool displaypoints
 Turn the points on.
bool displayedges
 Display the grid lines.


Detailed Description

Draw the pointgrid3D ojbect.

Call update() before drawing.

Some basic functionality such as displaying the points, displaying the edges. Simple set the boolean values to true.

Definition at line 17 of file pointgrid3Ddraw.h.


Constructor & Destructor Documentation

pointgrid3Ddraw::pointgrid3Ddraw ( pointgrid3D const &  pg_  ) 

Construct with point turned on.

Definition at line 4 of file pointgrid3Ddraw.cpp.

References displayedges, displaypoints, gobjQuadric::loops, quadric, gobjQuadric::radius, gobjQuadric::slices, and update().

00005   : gobjContainer(true), pg(_pg)
00006 {
00007   displaypoints=true;
00008 
00009   quadric = new gobjQuadric();
00010   quadric->radius = 0.02;
00011   quadric->slices=20;
00012   quadric->loops=6;
00013 
00014   displayedges=true;
00015 
00016   update();
00017 }

pointgrid3Ddraw::~pointgrid3Ddraw (  ) 

Cleanup.

Definition at line 19 of file pointgrid3Ddraw.cpp.

References quadric.

00020 {
00021   delete quadric;
00022 }


Member Function Documentation

void pointgrid3Ddraw::update (  ) 

Update the graphics by writing to the graphics container.

Definition at line 24 of file pointgrid3Ddraw.cpp.

References displayedges, displaypoints, pointgrid3D::M, pointgrid3D::N, gobjContainer::nuke(), pg, pointgrid3D::pij(), pointgrid3D::pt, gobjContainer::push(), quadric, and r.

Referenced by pointgrid3Ddraw(), meshpatchtest::test02(), and meshpatchtest::test04().

00025 {
00026   nuke();
00027 
00028   push( new gobjglPushAttrib(GL_LIGHTING) );
00029   push( new gobjglPushAttrib(GL_CURRENT_BIT) );
00030 
00031   if (displaypoints==true)
00032   {
00033     push(new gobjglEnable(GL_LIGHTING) );
00034     
00035     push( new gobjglColor3ub(0,255,0) );
00036     uintc sz = pg.M*pg.N;
00037     for (uint i=0; i<sz; ++i)
00038       push( new gobjMySphereDraw(pg.pt[i],quadric) );
00039   }
00040 
00041   if (displayedges==true)
00042   {
00043     push(new gobjglDisable(GL_LIGHTING) );
00044 
00045     push( new gobjglColor3ub(255,0,0) );
00046 
00047     uintc M = pg.M;
00048     uintc N = pg.N;
00049     uint r,k;
00050     push( new gobjglBegin(GL_LINE) ); 
00051 
00052     for (r=0; r<M; ++r)
00053     {
00054       for (k=1; k<N; ++k)
00055       {
00056         // Draw line pij(k-1,i) to pij(k,i)
00057         push( new gobjglVertex3f(pg.pij(k-1,r )) );
00058         push( new gobjglVertex3f(pg.pij(k,r )) );
00059       }
00060     }
00061 
00062     for (k=0; k<N; ++k)
00063     {
00064       for (r=1; r<M; ++r)
00065       {
00066         push( new gobjglVertex3f(pg.pij(k,r-1 )) );
00067         push( new gobjglVertex3f(pg.pij(k,r )) );
00068       }
00069     }
00070 
00071     push( new gobjglEnd() );
00072 
00073     push( new gobjglPopAttrib() );
00074     push( new gobjglPopAttrib() );
00075   }
00076 }


Member Data Documentation

Display the grid lines.

Definition at line 31 of file pointgrid3Ddraw.h.

Referenced by pointgrid3Ddraw(), and update().

Turn the points on.

Definition at line 28 of file pointgrid3Ddraw.h.

Referenced by pointgrid3Ddraw(), and update().

The object being drawn.

Definition at line 22 of file pointgrid3Ddraw.h.

Referenced by update().

The sphere at the points.

Definition at line 25 of file pointgrid3Ddraw.h.

Referenced by pointgrid3Ddraw(), update(), and ~pointgrid3Ddraw().


The documentation for this class was generated from the following files:

Generated on Fri Mar 4 00:50:10 2011 for Chelton Evans Source by  doxygen 1.5.8