gml_GRItem_GL.h

00001 // gml_GRItem_GL.h --
00002 //
00003 //    Declare the gml_TGRItem_GL class. On object of this class is instanciated by every
00004 //    gml_TGRItem that is rendered by OpenGL. gml_TGRItem_GL instances regroup the
00005 //    general utility functions and data for rendering a GRItem with OpenGL.
00006 //
00007 //  Copyright (c) 2004 CLIPS-IMAG
00008 //
00009 //  See the file "gml_LicenseTerms.txt" for information on usage and redistribution
00010 //  of this file, and for a DISCLAIMER OF ALL WARRANTIES.
00011 //
00012 //  14 jan, 2005: (FB, Sylvie Rouillard)
00013 //    Present it as a class.
00014 //    Separate drawing code from buffer selection code.
00015 //
00016 //  Created in 11/04 by Sylvie Rouillard.
00017 
00018 #ifndef __GML_GRITEM_GL__
00019 #define __GML_GRITEM_GL__
00020 
00021 
00022 #include "gml/base/gml_Errors.h"
00023 #include "gml/ui/gml_GRItem_Scene_GL.h"
00024 #include "gml/ui/gml_GRItem.h"
00025 
00026 
00027 
00028 // gml_TGRItem_GL --
00029 
00030 class gml_TGRItem_GL : virtual public gml_TGRItem
00031 {
00032 public:
00033 
00034   // Init --
00035   //
00036   //  Initialized the object. <scene> is the scene in which the item will be drawn.
00037 
00038   gml_TError              Init (gml_TGRItem_Scene_GL* scene);
00039 
00040   // Dispose --
00041   
00042   void                    Dispose ();
00043 
00044   // Draw --
00045   //
00046   //  Generic draw method for all OpenGL rendered items. Sets up clipping and calls
00047   //  item-specific "DrawGL" function.
00048 
00049   void                    Draw ();
00050 
00051   // DrawInStencil --
00052   //
00053   //  Generic method to draw OpenGL rendered items into the stencil buffer.
00054   //  Sets up OpenGL drawing buffer calls item-specific "DrawGL" function.
00055 
00056   void                    DrawInStencil ();
00057 
00058   // DrawGL --
00059   //
00060   //  A pure virtual method, the OpenGL directives to draw the item (either in a
00061   //  standard back buffer on in the stencil buffer).
00062   virtual
00063   void                    DrawGL () = 0;
00064 
00065   // Slot --
00066   //
00067   //  Returns the item's slot in the stencil buffer level cache.
00068   
00069   gml_TGRItem_ClippingCacheSlot
00070                           Slot ()
00071                             { return fSlot; }
00072 
00073 
00074 
00075 protected:
00076 
00077   // ActivateStencil --
00078   //
00079   //  Sets up the drawing buffer in which subsequent OpenGL directive will draw, and
00080   //  the stencil test if necessary.
00081   //    <testLevel>   is the level in the stencil buffer to do the stencil test with.
00082   //                    If -1, the stencil test is disabled.
00083   //    <drawLevel>   is the level in the stencil buffer at which to draw the item.
00084   //                    If -1, the item is not drawn in the stencil buffer but in the
00085   //                    back buffer instead.
00086   
00087   void                    ActivateStencil (int testLevel, int drawLevel);
00088 
00089 
00090   gml_TGRItem_Scene_GL*         fScene;     // The scene in which the item is drawn.
00091   gml_TGRItem_ClippingCacheSlot fSlot;      // The slot in stencil buffer
00092 };
00093 
00094 
00095 #endif
Generated on Tue Jun 12 14:03:27 2007 for gml by Doxygen 1.5.2.