proj home

Files   Classes   Functions   Hierarchy  

tessD2draw02multicolor< TESS, PT, INDX > Class Template Reference

Draw the triangles in random colors. More...

#include <tessD2draw02.h>

Inheritance diagram for tessD2draw02multicolor< TESS, PT, INDX >:
Collaboration diagram for tessD2draw02multicolor< TESS, PT, INDX >:

List of all members.

Public Member Functions

 tessD2draw02multicolor (TESS &tess_, bool &isdrawn_)
 Constructor.
void draw ()
 Draw to the global graphics stream.

Public Attributes

boolisdrawn
 Toggle the display.
double blend
 The alpha component.


Detailed Description

template<typename TESS, typename PT, typename INDX>
class tessD2draw02multicolor< TESS, PT, INDX >

Draw the triangles in random colors.

Assumes the tessellation has anti-clockwise winding.

Definition at line 96 of file tessD2draw02.h.


Constructor & Destructor Documentation

template<typename TESS, typename PT, typename INDX>
tessD2draw02multicolor< TESS, PT, INDX >::tessD2draw02multicolor ( TESS &  tess_,
bool isdrawn_ 
) [inline]

Constructor.

Definition at line 108 of file tessD2draw02.h.

00109     : tess(tess_), isdrawn(isdrawn_), blend(0.5) {}


Member Function Documentation

template<typename TESS , typename PT , typename INDX >
void tessD2draw02multicolor< TESS, PT, INDX >::draw (  )  [inline, virtual]

Draw to the global graphics stream.

Implements gobj.

Definition at line 239 of file tessD2draw02.h.

References gobj::global, gobjpush, tessD2draw02multicolor< TESS, PT, INDX >::isdrawn, gobjContainer::push(), and gobjContainer::set().

00240 {
00241   gobjContainer * preserve = gobjContainer::global;
00242   
00243   gobjContainer & y = * new gobjContainer(true);
00244   y.set();
00245 
00246   y.push( new gobjglPushAttrib(GL_CURRENT_BIT));
00247   y.push( new gobjglPushAttrib(GL_LIGHTING_BIT));
00248 
00249   y.push(new gobjglDisable(GL_LIGHTING));
00250   y.push( new gobjglEnable(GL_BLEND));
00251   y.push( new gobjglBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA));
00252 
00253   y.push( new gobjglBegin(GL_TRIANGLES));
00254 
00255   INDX const imax = tess.vi.size();
00256   for (INDX i=1; i<imax; ++i)
00257     drawtriangle(tess.vi[i],tess.pts);
00258 
00259   y.push( new gobjglEnd());
00260 
00261   y.push( new gobjglPopAttrib());
00262   y.push( new gobjglPopAttrib());
00263 
00264   gobjSwitch<bool&> * s = 
00265     new gobjSwitch<bool&>(&y,isdrawn);
00266 
00267   // Restore
00268   gobjContainer::global = preserve;
00269   
00270   gobjpush(s);
00271 }


Member Data Documentation

template<typename TESS, typename PT, typename INDX>
double tessD2draw02multicolor< TESS, PT, INDX >::blend

The alpha component.

Definition at line 105 of file tessD2draw02.h.

template<typename TESS, typename PT, typename INDX>
bool& tessD2draw02multicolor< TESS, PT, INDX >::isdrawn

Toggle the display.

Definition at line 102 of file tessD2draw02.h.

Referenced by tessD2draw02multicolor< TESS, PT, INDX >::draw().


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

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