glDisplayList.h

Go to the documentation of this file.
00001 // -*- Mode: C++; tab-width: 2; -*-
00002 // vi: set ts=2:
00003 //
00004 // $Id: glDisplayList.h,v 1.8.16.1 2007/03/25 21:26:14 oliver Exp $
00005 
00006 #ifndef BALL_VIEW_RENDERING_GLDISPLAYLIST_H
00007 #define BALL_VIEW_RENDERING_GLDISPLAYLIST_H
00008 
00009 #ifndef BALL_COMMON_H
00010 # include <BALL/common.h>
00011 #endif
00012 
00013 #include <QtOpenGL/qgl.h>
00014 
00015 namespace BALL
00016 {
00017   namespace VIEW
00018   {
00019 
00031 class BALL_VIEW_EXPORT GLDisplayList
00032 {
00033   public:
00034 
00035   BALL_CREATE(GLDisplayList)
00036 
00037   
00040 
00045   typedef unsigned long GLList;
00046 
00048 
00051   
00056   static const GLList DISPLAYLIST_NOT_DEFINED;
00057 
00059 
00062   
00068   class BALL_VIEW_EXPORT NestedDisplayList: public Exception::GeneralException
00069   {
00070     public:
00071 
00072     NestedDisplayList(const char* file, int line) ;
00073   };
00074 
00080   class BALL_VIEW_EXPORT NoDisplayListAvailable:  public Exception::GeneralException
00081   {
00082     public:
00083 
00084     NoDisplayListAvailable(const char* file, int line);
00085   };
00086 
00092   class BALL_VIEW_EXPORT DisplayListRedeclaration:  public Exception::GeneralException
00093   {
00094     public:
00095 
00096     DisplayListRedeclaration(const char* file, int line);
00097   };
00098 
00100 
00103 
00111   GLDisplayList();
00112 
00114 
00117 
00121   virtual ~GLDisplayList();
00122 
00126   virtual void clear();
00127 
00129 
00132 
00144   void startDefinition()
00145     throw(NestedDisplayList, NoDisplayListAvailable, DisplayListRedeclaration);
00146 
00151   void endDefinition();
00152 
00161   void draw();
00162 
00173   void useCompileMode();
00174 
00186   void useCompileAndExecuteMode();
00187 
00189 
00192 
00197   bool isCompileMode() const;
00198 
00203   bool isCompileAndExecuteMode() const;
00204 
00206 
00212   virtual bool isValid() const
00213     { return GL_list_ != 0; }
00214 
00221   virtual void dump(std::ostream& s = std::cout, Size depth = 0) const;
00222 
00224 
00225   private:
00226 
00227   /* compile switch */
00228   bool compile_;
00229 
00230   /* display list */
00231   GLList GL_list_;
00232 };
00233 
00234 # ifndef BALL_NO_INLINE_FUNCTIONS
00235 #   include <BALL/VIEW/RENDERING/glDisplayList.iC>
00236 # endif
00237 
00238   } // namespace VIEW
00239 } // namespace BALL
00240 
00241 #endif // BALL_VIEW_RENDERING_GLDISPLAYLIST_H