gml_GRItem_Polygon_GL.h

00001 // gml_GRItem_Polygon_GL.h --
00002 //
00003 //    OpenGL rendering of a Polygon item (see "gml_GRItem_Polygonh.h").
00004 //
00005 //  Copyright (c) 2004 CLIPS-IMAG
00006 //
00007 //  See the file "gml_LicenseTerms.txt" for information on usage and redistribution
00008 //  of this file, and for a DISCLAIMER OF ALL WARRANTIES.
00009 //
00010 //  Created on March 6, 2004 (FB).
00011 
00012 #ifndef __GML_GRITEM_POLYGON_GL__
00013 #define __GML_GRITEM_POLYGON_GL__
00014 
00015 #include "gml/ui/gml_GRItem_Scene_GL.h"
00016 #include "gml/ui/gml_GRItem_Polygon.h"
00017 #include "gml/ui/gml_GRItem_GL.h"
00018 
00019 #include "gml/gl/gml_GL_Base.h"
00020 #include "gml/gl/gml_GL_Texture.h"
00021 
00022 #include "gml/base/gml_DynamicArray.h"
00023 
00024 #ifndef CALLBACK
00025 #define CALLBACK
00026 #endif
00027 
00028 
00029 
00030 // Dynamic array of 2D points to store points created during tesselation.
00031 
00032 typedef struct gml_TGRItem2Dpoints
00033 {
00034   gml_TGRItemParam  coords[2];
00035 
00036 } gml_TGRItem2Dpoints;
00037 
00038 typedef gml_TDynamicArray<gml_TGRItem2Dpoints>   gml_TGRItem2DpointsArray;
00039 
00040 
00041 
00042 
00043 // gml_TGRItem_Polygon_GL --
00044 
00045 class gml_TGRItem_Polygon_GL : public gml_TGRItem_Polygon, public gml_TGRItem_GL
00046 {
00047 public:
00048 
00049   // Init --
00050   //
00051   //  See "gml_TGRItem::Init".
00052 
00053   gml_TError        Init (gml_TGRItem_Scene_GL* scene       = (gml_TGRItem_Scene_GL*)NULL,
00054                           gml_TGRItem*          parentItem  = (gml_TGRItem*)NULL,
00055                           gml_TGRItemTransfo*   transfo     = (gml_TGRItemTransfo*)NULL,
00056                           gml_TPointer          clientData  = (gml_TPointer)NULL);
00057   
00058   // Dispose --
00059   //
00060   //  See "gml_TGRItem::Dispose".
00061 
00062   void              Dispose ();
00063 
00064   
00065   // Suicide --
00066   //
00067   //  See "gml_TGRItem::Suicide".
00068 
00069   void              Suicide ()
00070                       { delete this; }
00071 
00072   // Configure --
00073   //
00074   //  See "gml_TGRItem_Polygon::Configure".
00075 
00076   gml_TError        Configure  (int*                shapeNbPt     = (int*)NULL,
00077                                 gml_TGRItemParam*   shape         = (gml_TGRItemParam*)NULL,
00078                                 gml_TBoolean*       outline       = (gml_TBoolean*)NULL,
00079                                 gml_TGRItemParam*   outlineWidth  = (gml_TGRItemParam*)NULL,
00080                                 gml_TRGBColor*      outlineColor  = (gml_TRGBColor*)NULL,
00081                                 gml_TGRItemParam*   outlineAlpha  = (gml_TGRItemParam*)NULL,
00082                                 gml_TBoolean*       outlineAAlias = (gml_TBoolean*)NULL,
00083                                 gml_TBoolean*       fill          = (gml_TBoolean*)NULL,
00084                                 gml_TRGBColor*      fillColor     = (gml_TRGBColor*)NULL,
00085                                 gml_TGRItemParam*   fillAlpha     = (gml_TGRItemParam*)NULL,
00086                                 gmlGL_TTexture**    texture       = (gmlGL_TTexture**)NULL,
00087                                 gml_TGRItemParam*   textureAlpha  = (gml_TGRItemParam*)NULL);
00088 
00089 
00090   // DrawGL --
00091   //
00092   //  See "gml_TGRItem_GL::DrawGL".
00093 
00094   void              DrawGL ();
00095 
00096 
00097   // PtArray --
00098   
00099   gml_TGRItem2DpointsArray*   PtArray ()
00100                                 { return fPtArray; }
00101 
00102 
00103 protected:
00104 
00105   // DrawList --
00106   //
00107   //  Issue OpenGL commands to draw the polygon while building the display list.
00108 
00109   void                        DrawList ();
00110 
00111   gml_TBoolean                fGLBranchInitialized; /* True if gml_TGRItem_GL::Init () has been called      */
00112   gml_TBoolean                fConfigDirty;         /* True if configure was called after last redraw       */
00113   GLfloat                     fGLOutlineColor[4];   /* OpenGL representation of the color of the outline    */
00114   GLfloat                     fGLFillColor[4];      /* OpenGL representation of the color of the interior   */
00115   GLuint                      fListIndex;           /* OpenGL display list id                               */
00116   GLUtesselator*              fTess;                /* GLU tesselation pointer                              */
00117   gml_TGRItem2DpointsArray*   fPtArray;             /* Array of points created during tesselation           */
00118 };
00119 
00120 
00121 
00122 #endif
Generated on Tue Jun 12 14:03:27 2007 for gml by Doxygen 1.5.2.