proj home

Files   Classes   Functions   Hierarchy  

gridsquare Class Reference

Draw a square grid. More...

#include <graphmisc.h>

Inheritance diagram for gridsquare:
Collaboration diagram for gridsquare:

List of all members.

Public Member Functions

 gridsquare (GLint factor, GLushort pattern, uintc xcolumns, uintc ycolumns, doublec xmax, doublec ymax)
 The lines are drawn using glLineStripple.


Detailed Description

Draw a square grid.

Essentially this is a ruler.

Example
  gridsquare * gs = new gridsquare(1,0xaaaa,5,5,1.0,1.0);
  gobjpush(gs);

Definition at line 935 of file graphmisc.h.


Constructor & Destructor Documentation

gridsquare::gridsquare ( GLint  factor,
GLushort  pattern,
uintc  xcolumns,
uintc  ycolumns,
doublec  xmax,
doublec  ymax 
)

The lines are drawn using glLineStripple.

Definition at line 416 of file graphmisc.cpp.

00424   : gobjContainer(true)
00425 {
00426   if ((xcolumns==0)||(ycolumns==0))
00427     return;
00428 
00429   double x=0.0;
00430   double y=0.0;
00431 
00432   doublec dx = xmax / xcolumns;
00433   doublec dy = ymax / ycolumns;
00434 
00435 //  doublec xmax = dx * xcolumns;
00436 //  doublec ymax = dy * ycolumns;
00437 
00438   push( new gobjglEnable(GL_LINE_STIPPLE));
00439   push( new gobjglLineStipple(factor,pattern) );
00440 
00441   push(new gobjglBegin(GL_LINES));
00442 
00443   for (uint i=0; i<=xcolumns; ++i)
00444   {
00445     x = dx * i;
00446     push(new gobjglVertex2f(x,0.0));
00447     push(new gobjglVertex2f(x,ymax));
00448   }
00449 
00450   for (uint i=0; i<=ycolumns; ++i)
00451   {
00452     y = dy * i;
00453     push(new gobjglVertex2f(0.0,y));
00454     push(new gobjglVertex2f(xmax,y));
00455   }
00456 
00457   push(new gobjglEnd());
00458 
00459   push(new gobjglDisable(GL_LINE_STIPPLE));
00460 }


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

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