TAPs 0.7.7.3
TAPsGLUTWindow.cpp
Go to the documentation of this file.
00001 /******************************************************************************
00002 TAPsGLUTWindow.cpp
00003 
00004 Create and maintain OpenGL Window by GLUT.
00005 
00006 SUKITTI PUNAK   (08/24/2005)
00007 UPDATE          (09/10/2010)
00008 ******************************************************************************/
00009 #include "TAPsGLUTWindow.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 // Static
00017 //-----------------------------------------------------------------------------
00018 int                 GLUTWindow::m_siID      = -1;
00019 GLUTCallbackFns *   GLUTWindow::m_spGLUT    = NULL;
00020 //-----------------------------------------------------------------------------
00021 //=============================================================================
00022 // Constructors and Destructor
00023 //-----------------------------------------------------------------------------
00024 GLUTWindow::GLUTWindow ( std::string const title, 
00025                          GLUTCallbackFns * const pGLUT, 
00026                          int width , int height )
00027     :   m_strTitle( title ),
00028         m_pGLUT( NULL )
00029 {
00030     glutInitDisplayMode( GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH );
00031     glutInitWindowSize( width, height );
00032     const char * p = title.data();
00033     m_iID = glutCreateWindow( p );
00034     if ( pGLUT )    SetGLUT( pGLUT );
00035 }
00036 //-----------------------------------------------------------------------------
00037 GLUTWindow::GLUTWindow ( std::string const title, 
00038                          int width , int height )
00039     :   m_strTitle( title ),
00040         m_pGLUT( NULL )
00041 {
00042     glutInitDisplayMode( GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH );
00043     glutInitWindowSize( width, height );
00044     const char * p = title.data();
00045     m_iID = glutCreateWindow( p );
00046 }
00047 //-----------------------------------------------------------------------------
00048 GLUTWindow::~GLUTWindow ()
00049 {}
00050 //-----------------------------------------------------------------------------
00051 //=============================================================================
00052 // Set GLUT
00053 //-----------------------------------------------------------------------------
00054 void GLUTWindow::SetGLUT ( GLUTCallbackFns * const pGLUT )
00055 {
00056     assert( pGLUT );
00057     m_spGLUT = m_pGLUT = pGLUT;
00058     m_siID = m_iID;
00059     glutDisplayFunc( Display );
00060     glutReshapeFunc( Reshape );
00061     glutMouseFunc( Mouse );
00062     glutMotionFunc( Motion );
00063     glutKeyboardFunc( Keyboard );
00064     glutSpecialFunc( Special );
00065     glutIdleFunc( Idle );
00066 }
00067 //-----------------------------------------------------------------------------
00068 //=============================================================================
00069 END_NAMESPACE_TAPs__OpenGL
00070 //345678901234567890123456789012345678901234567890123456789012345678901234567890
00071 //--+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines