Blender V2.61 - r43446

GlutDrawer.h

Go to the documentation of this file.
00001 
00028 #ifndef NAN_INCLUDED_GlutDrawer
00029 #define NAN_INCLUDED_GlutDrawer
00030 
00031 #include "MEM_NonCopyable.h"
00032 #include "MEM_SmartPtr.h"
00033 
00034 // So pissed off with Glut callback stuff
00035 // that is impossible to call objects unless they are global
00036 
00037 // inherit from GlutDrawer and installl the drawer in the singleton
00038 // class GlutDrawManager.
00039 
00040 class GlutDrawer {
00041 public :
00042 
00043     virtual 
00044         void
00045     Draw(
00046     )= 0;
00047 
00048     virtual 
00049     ~GlutDrawer(
00050     ){};        
00051 };
00052 
00053 class GlutDrawManager : public MEM_NonCopyable{
00054 
00055 public :
00056 
00057     static
00058         GlutDrawManager *
00059     Instance(
00060     );
00061 
00062     // this is the function you should pass to glut
00063 
00064     static
00065         void
00066     Draw(
00067     );
00068 
00069         void
00070     InstallDrawer(
00071         GlutDrawer *
00072     );
00073 
00074         void
00075     ReleaseDrawer(
00076     );
00077 
00078     ~GlutDrawManager(
00079     );
00080 
00081 private :
00082 
00083     GlutDrawManager (
00084     ) :
00085         m_drawer (0)
00086     {
00087     };
00088     
00089     GlutDrawer * m_drawer;
00090 
00091     static MEM_SmartPtr<GlutDrawManager> m_s_instance;
00092 };  
00093 
00094 
00095 #endif
00096