Blender V2.61 - r43446
|
00001 00028 #include "GlutDrawer.h" 00029 00030 #include "MT_assert.h" 00031 00032 MEM_SmartPtr<GlutDrawManager> GlutDrawManager::m_s_instance = MEM_SmartPtr<GlutDrawManager>(); 00033 00034 GlutDrawManager * 00035 GlutDrawManager:: 00036 Instance( 00037 ){ 00038 if (m_s_instance == NULL) { 00039 m_s_instance = new GlutDrawManager(); 00040 } 00041 00042 return m_s_instance; 00043 } 00044 00045 00046 // this is the function you should pass to glut 00047 00048 void 00049 GlutDrawManager:: 00050 Draw( 00051 ){ 00052 GlutDrawManager *manager = GlutDrawManager::Instance(); 00053 00054 if (manager->m_drawer != NULL) { 00055 manager->m_drawer->Draw(); 00056 } 00057 } 00058 00059 void 00060 GlutDrawManager:: 00061 InstallDrawer( 00062 GlutDrawer * drawer 00063 ){ 00064 00065 MT_assert(m_drawer == NULL); 00066 m_drawer = drawer; 00067 } 00068 00069 void 00070 GlutDrawManager:: 00071 ReleaseDrawer( 00072 ){ 00073 m_drawer = NULL; 00074 } 00075 00076 00077 GlutDrawManager:: 00078 ~GlutDrawManager( 00079 ){ 00080 00081 delete(m_drawer); 00082 } 00083 00084 00085 00086 00087 00088 00089 00090 00091