Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages

polygonMode.h

Go to the documentation of this file.
00001 /* ***********************************************************************************
00002         Writer:         Sebastien Bloc
00003         Copyright:      2003-2004
00004         eMail:          sebastien.bloc@free.fr
00005         URL:            http://mignonsoft.free.fr
00006 
00007         This program is free software; you can redistribute it and/or
00008         modify it under the terms of the GNU General Public License
00009         as published by the Free Software Foundation; either version 2
00010         of the License, or (at your option) any later version.
00011 
00012         This program is distributed in the hope that it will be useful,
00013         but WITHOUT ANY WARRANTY; without even the implied warranty of
00014         MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015         GNU General Public License for more details.
00016         http://www.gnu.org/copyleft/gpl.html    
00017 *********************************************************************************** */
00018 
00023 #ifndef INCLUDE_POLYGON_MODE_H
00024 #define INCLUDE_POLYGON_MODE_H
00025 
00026 typedef enum
00027 {
00028         fill = GL_FILL,
00029         line = GL_LINE,
00030         point = GL_POINT
00031 } PolygonModeType;
00032 
00036 class PolygonMode
00037 {
00038 public:
00039         PolygonModeType front,back;
00040         PolygonMode()
00041         {
00042                 front = fill;
00043                 back = fill;
00044         }
00045 
00046         void Use(PolygonModeType _front,PolygonModeType _back)
00047         {
00048                 front = _front;
00049                 back = _back;
00050                 Use();
00051         }
00052 
00053         void Use()
00054         {
00055                 glPolygonMode(GL_FRONT, front);
00056                 glPolygonMode(GL_BACK, back);
00057         }
00058 
00059         void ToString(MyString &src)
00060         {
00061                 MyString frontTxt,backTxt;
00062                 Traduce(front,frontTxt);
00063                 Traduce(back,backTxt);
00064                 src<<"front:"<<frontTxt<<" back:"<<backTxt;
00065         }
00066 
00067         void Traduce(PolygonModeType mode,MyString &dest)
00068         {
00069                 switch(mode)
00070                 {
00071                 case fill: dest="fill"; break;
00072                 case line: dest="line"; break;
00073                 case point: dest="point"; break;
00074                 default: dest="<Unknown>";
00075                 }
00076         }
00077 };
00078 
00079 #endif

Generated on Fri Aug 20 19:19:48 2004 for 3d Controls by doxygen 1.3.6