GLUTCallbackFns Class Reference

#include <TAPsGLUTCallbackFns.hpp>

Inheritance diagram for GLUTCallbackFns:

Inheritance graph
[legend]

List of all members.

Public Member Functions

virtual void DisplayFn ()
 GLUTCallbackFns ()
virtual void IdleFn ()
virtual void Initialize ()
virtual void KeyboardFn (unsigned char key, int x, int y)
virtual void MotionFn (int x, int y)
virtual void MouseFn (int button, int state, int x, int y)
virtual void ReshapeFn (int width, int height)
virtual void SpecialFn (int key, int x, int y)
virtual ~GLUTCallbackFns ()


Detailed Description

Definition at line 23 of file TAPsGLUTCallbackFns.hpp.


Constructor & Destructor Documentation

BEGIN_NAMESPACE_TAPs__OpenGL GLUTCallbackFns::GLUTCallbackFns (  ) 

Definition at line 19 of file TAPsGLUTCallbackFns.cpp.

00020 {}

GLUTCallbackFns::~GLUTCallbackFns (  )  [virtual]

Definition at line 22 of file TAPsGLUTCallbackFns.cpp.

00023 {}


Member Function Documentation

void GLUTCallbackFns::DisplayFn (  )  [virtual]

Reimplemented in DerivedGLUTCallbackFns.

Definition at line 28 of file TAPsGLUTCallbackFns.cpp.

00029 {   
00030     glClearColor( 1, 1, 1, 1 );
00031     static const GLfloat light_model_ambient[] = { 0.5f, 0.5f, 0.5f, 1.0f };
00032     glLightModelfv( GL_LIGHT_MODEL_AMBIENT, light_model_ambient );
00033     TAPs::OpenGL::Fn::InitializeLight( GL_LIGHT0, 
00034             0.3f, 0.3f, 0.3f, 1.0f,     // ambient
00035             0.4f, 0.45f, 0.4f, 0.9f,    // diffuse
00036             0.5f, 0.5f, 1.0f, 0.5f,     // specular
00037             0.0f, 0.4f, 1.0f, 0.0f      // position
00038     );
00039     Material m;
00040     m.SetMaterial( Enum::METAL_SILVER );
00041     m.ApplyMaterial( Enum::FRONT );
00042     glEnable( GL_DEPTH_TEST );
00043     glEnable( GL_LIGHTING );
00044     //----------------------------------------------------------------
00045     glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
00046     glRotatef( 0.2, 1, 0, 0 );
00047     glRotatef( 0.4, 0, 1, 0 );
00048     glRotatef( 0.8, 0, 0, 1 );
00049     glutSolidCube( 50 );
00050     glutPostRedisplay();
00051     glutSwapBuffers();
00052 }

void GLUTCallbackFns::IdleFn (  )  [virtual]

Reimplemented in DerivedGLUTCallbackFns.

Definition at line 178 of file TAPsGLUTCallbackFns.cpp.

00179 {
00180     //----------------------------------------------------------------
00181     //----------------------------------------------------------------
00182 }

void GLUTCallbackFns::Initialize (  )  [virtual]

Reimplemented in DerivedGLUTCallbackFns.

Definition at line 187 of file TAPsGLUTCallbackFns.cpp.

00188 {
00189     //----------------------------------------------------------------
00190     //----------------------------------------------------------------
00191 }

void GLUTCallbackFns::KeyboardFn ( unsigned char  key,
int  x,
int  y 
) [virtual]

Reimplemented in DerivedGLUTCallbackFns.

Definition at line 97 of file TAPsGLUTCallbackFns.cpp.

00098 {
00099     //----------------------------------------------------------------
00100     switch ( key ) {
00101         case 'q':
00102         case 'Q':
00103         case 27:        // ESC for exit the program
00104             exit( EXIT_SUCCESS );
00105             break;
00106     }
00107     //----------------------------------------------------------------
00108     //glutPostRedisplay();
00109     //----------------------------------------------------------------
00110 }

void GLUTCallbackFns::MotionFn ( int  x,
int  y 
) [virtual]

Reimplemented in DerivedGLUTCallbackFns.

Definition at line 169 of file TAPsGLUTCallbackFns.cpp.

00170 {
00171     //----------------------------------------------------------------
00172     //----------------------------------------------------------------
00173 }

void GLUTCallbackFns::MouseFn ( int  button,
int  state,
int  x,
int  y 
) [virtual]

Reimplemented in DerivedGLUTCallbackFns.

Definition at line 138 of file TAPsGLUTCallbackFns.cpp.

00139 {
00140     //----------------------------------------------------------------
00141     if ( state == GLUT_DOWN ) {
00142         //------------------------------------------------------
00143         if ( button == GLUT_LEFT_BUTTON ) {
00144         }
00145         //------------------------------------------------------
00146         else if ( button == GLUT_MIDDLE_BUTTON ) {
00147         }
00148         //------------------------------------------------------
00149         else if ( button == GLUT_RIGHT_BUTTON ) {
00150         }
00151     }
00152     else if ( state == GLUT_UP ) {
00153         //------------------------------------------------------
00154         if ( button == GLUT_LEFT_BUTTON ) {
00155         }
00156         //------------------------------------------------------
00157         else if ( button == GLUT_MIDDLE_BUTTON ) {
00158         }
00159         //------------------------------------------------------
00160         else if ( button == GLUT_RIGHT_BUTTON ) {
00161         }
00162     }
00163     //----------------------------------------------------------------
00164 }

void GLUTCallbackFns::ReshapeFn ( int  width,
int  height 
) [virtual]

Reimplemented in DerivedGLUTCallbackFns.

Definition at line 57 of file TAPsGLUTCallbackFns.cpp.

00058 {
00059     /*
00060     static const float K_FOV_Y = 40;
00061     static const float K_CANONICAL_SPHERE_RADIUS = sqrt( 3.0f );
00062     static const float K_PI = 3.1415926535897932384626433832795;
00063     //-------------------------------------------------------------------
00064     glViewport( 0, 0, static_cast<GLsizei>(width), static_cast<GLsizei>(height) );
00065     //-------------------------------------------------------------------
00066     // Compute the viewing parameters based on a fixed fov and viewing
00067     // sphere enclosing a canonical box centered at the origin
00068     //T nearDist = K_CANONICAL_SPHERE_RADIUS / tan( (K_FOV_Y/2.0) * K_PI / 180.0 );
00069     //T farDist  = nearDist + 2.0 * K_CANONICAL_SPHERE_RADIUS;
00070     float nearDist = 1;
00071     float farDist  = 100;
00072     //std::cout << "nearDist: " << nearDist << " farDist: " << farDist << std::endl;
00073     float aspect   = static_cast<float>(width) / static_cast<float>(height);
00074     //-------------------------------------------------------------------
00075     glMatrixMode( GL_PROJECTION );
00076     glLoadIdentity();
00077     gluPerspective( K_FOV_Y, aspect, nearDist, farDist );
00078     */ 
00079 
00080     glViewport( 0, 0, width, height );
00081     glMatrixMode( GL_PROJECTION );
00082     glLoadIdentity();
00083     gluPerspective( 45.0, (float)width / (float)height, 0.1, 1000.0 );
00084     glMatrixMode( GL_MODELVIEW );
00085     glLoadIdentity();
00086     gluLookAt(
00087         0, 0, 200,  // eye position
00088         0, 0, 0,    // look at
00089         0, 1, 0     // up vector
00090     );
00091 
00092 }

void GLUTCallbackFns::SpecialFn ( int  key,
int  x,
int  y 
) [virtual]

Reimplemented in DerivedGLUTCallbackFns.

Definition at line 115 of file TAPsGLUTCallbackFns.cpp.

00116 {
00117     //----------------------------------------------------------------
00118     switch ( key ) {
00119         case GLUT_KEY_F1:
00120             break;
00121         case GLUT_KEY_UP:
00122             break;
00123         case GLUT_KEY_DOWN:
00124             break;
00125         case GLUT_KEY_LEFT:
00126             break;
00127         case GLUT_KEY_RIGHT:
00128             break;
00129     }
00130     //----------------------------------------------------------------
00131     //glutPostRedisplay();
00132     //----------------------------------------------------------------
00133 }


The documentation for this class was generated from the following files:

Generated on Mon Oct 13 11:44:51 2008 for TAPs by  doxygen 1.5.6