TAPs 0.7.7.3
TAPsCheckerPlane.cpp
Go to the documentation of this file.
00001 /******************************************************************************
00002 TAPsCheckerPlane.cpp
00003 
00004 A checker plane
00005 
00006 SUKITTI PUNAK   (11/21/2004)
00007 UPDATE          (11/21/2004)
00008 ******************************************************************************/
00009 #include "TAPsCheckerPlane.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 MeshModel<T>::MeshModel ()
00020     : OpenGLModel<T>(), 
00021       m_iNoVertices( 0 ), 
00022       m_iNoFaces( 0 ), 
00023       m_iNoTexCoords( 0 )
00024 {
00025     #ifdef  TAPs_DEBUG_MODE
00026     std::cout << "MeshModel<" << typeid(T).name() << "> constructor\n";
00027     #endif//TAPs_DEBUG_MODE
00028 }
00029 //-----------------------------------------------------------------------------
00030 // destructor
00031 template <typename T>
00032 MeshModel<T>::~MeshModel ()
00033 {
00034     #ifdef  TAPs_DEBUG_MODE
00035     std::cout << "MeshModel<" << typeid(T).name() << "> destructor\n";
00036     #endif//TAPs_DEBUG_MODE
00037 }
00038 //-----------------------------------------------------------------------------
00039 // Get/Set Fn(s)
00040 template <typename T>
00041 inline int  MeshModel<T>::GetNoVertices() const { return m_iNoVertices; }
00042 //-----------------------------------------------------------------------------
00043 // Helper Fn(s)
00044 /*
00045 void generateCheckertexture ()
00046 {
00047     makeCheckImages();
00048 
00049     glPixelStorei( GL_UNPACK_ALIGNMENT, 1 );
00050     glGenTextures( 2, texName );
00051     
00052     glBindTexture( GL_TEXTURE_2D, texName[0] );
00053     glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP );
00054     glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP );
00055     glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST );
00056     glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST );
00057     glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA, checkImageWidth, checkImageHeight, 
00058                     0, GL_RGBA, GL_UNSIGNED_BYTE, checkImage );
00059 
00060     glBindTexture( GL_TEXTURE_2D, texName[1] );
00061     glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP );
00062     glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP );
00063     glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST );
00064     glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST );
00065     glTexEnvf( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE );
00066     glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA, checkImageWidth, checkImageHeight, 
00067                     0, GL_RGBA, GL_UNSIGNED_BYTE, checkImage );
00068     
00069     glBindTexture( GL_TEXTURE_2D, texName[2] );
00070 
00071     glEnable( GL_TEXTURE_2D );
00072 }
00073 //-----------------------------------------------------------------------------
00074 void makeCheckerImages ()
00075 {
00076     int r, c, v;
00077     for ( r = 0; r < m_iCheckerImageHeight; r++ ) {
00078         for ( c = 0; c < m_iCheckerImageWidth; c++ ) {
00079             v = ( ((r&0x8)==0) ^ ((c&0x8)==0) ) * 75 + 180;
00080             checkImage[r][c][0] = (GLubyte) v;
00081             checkImage[r][c][1] = (GLubyte) v;
00082             checkImage[r][c][2] = (GLubyte) v;
00083             checkImage[r][c][3] = (GLubyte) 255;
00084             v = ( ((r&0x10)==0) ^ ((c&0x10)==0) ) * 255;
00085             otherImage[r][c][0] = (GLubyte) v;
00086             otherImage[r][c][1] = (GLubyte) 0;
00087             otherImage[r][c][2] = (GLubyte) 0;
00088             otherImage[r][c][3] = (GLubyte) 255;
00089         }
00090     }
00091 } // END:   makeCheckerImage()
00092 */
00093 //-----------------------------------------------------------------------------
00094 //=============================================================================
00095 END_NAMESPACE_TAPs__OpenGL
00096 //-----------------------------------------------------------------------------
00097 //345678901234567890123456789012345678901234567890123456789012345678901234567890
00098 //--+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines