TAPs 0.7.7.3
TAPsOpenGLManager.cpp
Go to the documentation of this file.
00001 /******************************************************************************
00002 TAPsOpenGLManager.cpp
00003 
00004 Declares the pure virtual interface for OpenGL Manager
00005 
00006 SUKITTI PUNAK   (05/07/2006)
00007 UPDATE          (05/07/2006)
00008 ******************************************************************************/
00009 #include "TAPsBaseOpenGLManager.hpp"
00010 // Using Inclusion Model (i.e. definitions are included in declarations)
00011 //                       (this name.cpp is included in name.hpp)
00012 // Each friend is defined directly inside its declaration.
00013 
00014 BEGIN_NAMESPACE_TAPs__OpenGL
00015 //=============================================================================
00016 //-----------------------------------------------------------------------------
00017 // Default Constructor
00018 template <typename T>
00019 OpenGLManager<T>::OpenGLManager ()
00020     : BaseOpenGLManager<T>()
00021 {
00022     CreationAddOn();
00023 }
00024 //-----------------------------------------------------------------------------
00025 // Destructor
00026 template <typename T>
00027 OpenGLManager<T>::~OpenGLManager ()
00028 {
00029     Cleanup();
00030 }
00031 //-----------------------------------------------------------------------------
00032 // CreationAddOn
00033 template <typename T>
00034 void OpenGLManager<T>::CreationAddOn ()
00035 {
00036 }
00037 //-----------------------------------------------------------------------------
00038 //template <typename T>
00039 //void OpenGLManager<T>::Setup ( ::wxGLCanvas * pGLCanvas )
00040 //{}
00041 //-----------------------------------------------------------------------------
00042 template <typename T>
00043 void OpenGLManager<T>::Cleanup ()
00044 {
00045     //m_pGLCanvas = NULL;
00046     //---------------------------------------------------------------
00047     if ( m_pOpenGLViewManager ) {
00048         delete m_pOpenGLViewManager;
00049         m_pOpenGLViewManager = NULL;
00050     }
00051     if ( m_pOpenGLModelManager ) {
00052         delete m_pOpenGLModelManager;
00053         m_pOpenGLModelManager = NULL;
00054     }
00055 #ifdef TAPs_USE_HAPTIC
00056     if ( m_pOpenGLHapticManager ) {
00057         delete m_pOpenGLHapticManager;
00058         m_pOpenGLHapticManager = NULL;
00059     }
00060 #endif
00061 }
00062 //-----------------------------------------------------------------------------
00063 template <typename T>
00064 void OpenGLManager<T>::InitGL ()
00065 {
00066     if ( !m_pOpenGLViewManager ) {
00067         m_pOpenGLViewManager = new TAPs::OpenGL::OpenGLViewManager<T>();
00068         assert( m_pOpenGLViewManager );
00069         m_pOpenGLViewManager->Setup();  // OpenGL Setting; light, camera
00070     }
00071     if ( !m_pOpenGLModelManager ) {
00072         m_pOpenGLModelManager = new TAPs::OpenGL::OpenGLModelManager<T>();
00073     }
00074 #ifdef TAPs_USE_HAPTIC
00075     if ( m_pOpenGLHapticManager ) {
00076         m_pOpenGLHapticManager = new TAPs::OpenGL::OpenGLHapticManager<T>();
00077         assert( m_pOpenGLHapticManager );
00078         m_pOpenGLHapticManager->Setup( m_pOpenGLModelManager, m_pOpenGLViewManager );
00079     }
00080 #endif
00081 }
00082 //-----------------------------------------------------------------------------
00083 //=============================================================================
00084 END_NAMESPACE_TAPs__OpenGL
00085 //-----------------------------------------------------------------------------
00086 //345678901234567890123456789012345678901234567890123456789012345678901234567890
00087 //--+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines