00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
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