Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   Related Pages  

sglPolygonStipple Class Reference

#include <sglStatelet.hpp>

Inheritance diagram for sglPolygonStipple::

sglStatelet sglObject List of all members.

Public Methods

 sglPolygonStipple (const GLubyte *pattern=NULL)
virtual ~sglPolygonStipple ()
void setPolygonStipple (const GLubyte *pattern)
const GLubyte* getPolygonStipple () const
bool getPolygonStippleFlag () const
void apply (sglCurrState *curr_state) const
virtual bool getSorted () const
virtual void printInfo (ostream &ostrm, const char *indent_string) const

Detailed Description

This statelet encapsulates OpenGL's glPolygonStipple() and glEnable(GL_POLYGON_STIPPLE) commands which defines the 32x32 bit stipple pattern where each bit corresponds to whether or not the corresponding pixel in the polygon is rendered (1) or not (0). The 32x32 bit pattern is defined with an 128 byte memory block starting in the lower left of the bitmap scanning to the right and upwards (see the OpenGL Red Book for details). A pointer to this memory is passed to the setPolygonStipple function to set the pattern (or pass it into the constructor). This memory is then copied into the class's internal memory. Passing NULL in for the pattern parameter disables polygon stipple.

WARNING: this statelet issues glPixelStorei(GL_UNPACK_*, ) commands for ALIGNMENT (4), ROW_LENGTH (0), SKIP_ROWS (0), SKIP_PIXELS (0), and may interfere with user settings in the application outside of SGL.

Example:

   GLubtye pattern[128] = { 0x10, 0x18, 0x18, 0x08,      // first (bottom) row
                                    :
                            0x10, 0x18, 0x18, 0x08 };    // last (top) row

   sglPolygonStipple *pstipple = new sglPolygonStipple;  // disabled by default
   pstipple->setPolygonStipple(pattern);                 // set the pattern

Definition at line 2015 of file sglStatelet.hpp.


Constructor & Destructor Documentation

sglPolygonStipple::sglPolygonStipple ( const GLubyte * pattern = NULL ) [inline]
 

Constructor (also the default constructor).

Parameters:
pattern   Pointer to 128 packed bytes that define the stipple pattern. Passing in NULL (the default) disables this statelet.

Definition at line 2022 of file sglStatelet.hpp.

sglPolygonStipple::~sglPolygonStipple ( ) [inline, virtual]
 

virtual destructor.

Definition at line 2027 of file sglStatelet.hpp.


Member Function Documentation

void sglPolygonStipple::setPolygonStipple ( const GLubyte * pattern )
 

Set the polygon stipple pattern.

Parameters:
pattern   Pointer to 128 packed bytes that define the stipple pattern. Passing in NULL disables this statelet.

Referenced by sglPolygonStipple().

const GLubyte * sglPolygonStipple::getPolygonStipple ( ) const [inline]
 

Query the current polygon stipple pattern.

Returns:
A pointer to the stipple pattern (if enabled) or NULL (if disabled). Note that this class passes back a pointer to internal data, and the user should copy this data to memory that they "own" to ensure that this pointer is not invalidated if the statelet is destructed.

Definition at line 2042 of file sglStatelet.hpp.

bool sglPolygonStipple::getPolygonStippleFlag ( ) const [inline]
 

Query whether or not this statelet is enabled.

Returns:
true if a non-NULL pointer has been supplied for the pattern; otherwise false.

Definition at line 2054 of file sglStatelet.hpp.

void sglPolygonStipple::apply ( sglCurrState * curr_state ) const [virtual]
 

Apply this state change to the current rendering state.

Parameters:
curr_state   Required for statelets that affect one another. For example the sglTransparency sets up depth mask and blending modes which interact with the sglBlending and sglDepthMask statelets, and the curr_state object is used to resolve these internal issues.

Reimplemented from sglStatelet.

bool sglPolygonStipple::getSorted ( ) const [inline, virtual]
 

Query the sorting mode for this statelet.

Returns:
true if this type of statelet should be sorted by pointer rather than using m_index to index into an array. The defualt implementation is the latter, but if a statelet can take on an inordinate number of states (e.g. a floating point parameter) then true should be returned.

Reimplemented from sglStatelet.

Definition at line 2060 of file sglStatelet.hpp.

virtual void sglPolygonStipple::printInfo ( ostream & ostrm,
const char * indent_string ) const [virtual]
 

Output the state of this node to the specified ostream.

Parameters:
ostrm   the ostream to which the output is sent
indent_string   the string (usually spaces) that is output at the beginning of every line of output

Reimplemented from sglStatelet.


The documentation for this class was generated from the following file:
Generated at Mon Jul 1 18:00:09 2002 for SGL by doxygen1.2.6 written by Dimitri van Heesch, © 1997-2001