TAPs 0.7.7.3
STAPsDerivedGLUTCallbackFns.cpp
Go to the documentation of this file.
00001 /******************************************************************************
00002 STAPsDerivedGLUTCallbackFns.cpp
00003 
00004 See STAPsGLUTCallbackFns.hpp
00005 
00006 SUKITTI PUNAK   (09/10/2010)
00007 UPDATE          (09/10/2010)
00008 ******************************************************************************/
00009 #include "STAPsDerivedGLUTCallbackFns.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 // Constructor(s) and Destructor
00017 //-----------------------------------------------------------------------------
00018 DerivedGLUTCallbackFns::DerivedGLUTCallbackFns ()
00019 {}
00020 //-----------------------------------------------------------------------------
00021 DerivedGLUTCallbackFns::~DerivedGLUTCallbackFns ()
00022 {}
00023 //-----------------------------------------------------------------------------
00024 //=============================================================================
00025 // DisplayFn
00026 //-----------------------------------------------------------------------------
00027 void DerivedGLUTCallbackFns::DisplayFn ()
00028 {   
00029     glClearColor( 1, 1, 1, 1 );
00030     glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
00031 
00032     //...
00033 
00034     glutPostRedisplay();
00035     glutSwapBuffers();
00036 }
00037 //-----------------------------------------------------------------------------
00038 //=============================================================================
00039 // ReshapeFn
00040 //-----------------------------------------------------------------------------
00041 void DerivedGLUTCallbackFns::ReshapeFn ( int width, int height )
00042 {
00043     /*
00044     static const float K_FOV_Y = 40;
00045     static const float K_CANONICAL_SPHERE_RADIUS = sqrt( 3.0f );
00046     static const float K_PI = 3.1415926535897932384626433832795;
00047     //-------------------------------------------------------------------
00048     glViewport( 0, 0, static_cast<GLsizei>(width), static_cast<GLsizei>(height) );
00049     //-------------------------------------------------------------------
00050     // Compute the viewing parameters based on a fixed fov and viewing
00051     // sphere enclosing a canonical box centered at the origin
00052     //T nearDist = K_CANONICAL_SPHERE_RADIUS / tan( (K_FOV_Y/2.0) * K_PI / 180.0 );
00053     //T farDist  = nearDist + 2.0 * K_CANONICAL_SPHERE_RADIUS;
00054     float nearDist = 1;
00055     float farDist  = 100;
00056     //std::cout << "nearDist: " << nearDist << " farDist: " << farDist << std::endl;
00057     float aspect   = static_cast<float>(width) / static_cast<float>(height);
00058     //-------------------------------------------------------------------
00059     glMatrixMode( GL_PROJECTION );
00060     glLoadIdentity();
00061     gluPerspective( K_FOV_Y, aspect, nearDist, farDist );
00062     */ 
00063 }
00064 //-----------------------------------------------------------------------------
00065 //=============================================================================
00066 // KeyboardFn
00067 //-----------------------------------------------------------------------------
00068 void DerivedGLUTCallbackFns::KeyboardFn ( unsigned char key, int x, int y )
00069 {
00070     //----------------------------------------------------------------
00071     switch ( key ) {
00072         case 'q':
00073         case 'Q':
00074         case 27:        // ESC for exit the program
00075             exit( EXIT_SUCCESS );
00076             break;
00077     }
00078     //----------------------------------------------------------------
00079     //glutPostRedisplay();
00080     //----------------------------------------------------------------
00081 }
00082 //-----------------------------------------------------------------------------
00083 //=============================================================================
00084 // SpecialFn
00085 //-----------------------------------------------------------------------------
00086 void DerivedGLUTCallbackFns::SpecialFn ( int key, int x, int y )
00087 {
00088     //----------------------------------------------------------------
00089     switch ( key ) {
00090         case GLUT_KEY_F1:
00091             break;
00092         case GLUT_KEY_UP:
00093             break;
00094         case GLUT_KEY_DOWN:
00095             break;
00096         case GLUT_KEY_LEFT:
00097             break;
00098         case GLUT_KEY_RIGHT:
00099             break;
00100     }
00101     //----------------------------------------------------------------
00102     //glutPostRedisplay();
00103     //----------------------------------------------------------------
00104 }
00105 //-----------------------------------------------------------------------------
00106 //=============================================================================
00107 // MouseFn
00108 //-----------------------------------------------------------------------------
00109 void DerivedGLUTCallbackFns::MouseFn ( int button, int state, int x, int y )
00110 {
00111     //----------------------------------------------------------------
00112     if ( state == GLUT_DOWN ) {
00113         //------------------------------------------------------
00114         if ( button == GLUT_LEFT_BUTTON ) {
00115         }
00116         //------------------------------------------------------
00117         else if ( button == GLUT_MIDDLE_BUTTON ) {
00118         }
00119         //------------------------------------------------------
00120         else if ( button == GLUT_RIGHT_BUTTON ) {
00121         }
00122     }
00123     else if ( state == GLUT_UP ) {
00124         //------------------------------------------------------
00125         if ( button == GLUT_LEFT_BUTTON ) {
00126         }
00127         //------------------------------------------------------
00128         else if ( button == GLUT_MIDDLE_BUTTON ) {
00129         }
00130         //------------------------------------------------------
00131         else if ( button == GLUT_RIGHT_BUTTON ) {
00132         }
00133     }
00134     //----------------------------------------------------------------
00135 }
00136 //-----------------------------------------------------------------------------
00137 //=============================================================================
00138 // MotionFn
00139 //-----------------------------------------------------------------------------
00140 void DerivedGLUTCallbackFns::MotionFn ( int x, int y )
00141 {
00142     //----------------------------------------------------------------
00143     //----------------------------------------------------------------
00144 }
00145 //-----------------------------------------------------------------------------
00146 //=============================================================================
00147 // IdleFn
00148 //-----------------------------------------------------------------------------
00149 void DerivedGLUTCallbackFns::IdleFn ()
00150 {
00151     //----------------------------------------------------------------
00152     //----------------------------------------------------------------
00153 }
00154 //-----------------------------------------------------------------------------
00155 //=============================================================================
00156 // Initialize
00157 //-----------------------------------------------------------------------------
00158 void DerivedGLUTCallbackFns::Initialize ()
00159 {
00160     //----------------------------------------------------------------
00161     //----------------------------------------------------------------
00162 }
00163 //-----------------------------------------------------------------------------
00164 //=============================================================================
00165 END_NAMESPACE_TAPs__OpenGL
00166 //345678901234567890123456789012345678901234567890123456789012345678901234567890
00167 //--+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines