OpenGLBox Class Reference

#include <TAPsOpenGLBox.hpp>

Inheritance diagram for OpenGLBox:

Inheritance graph
[legend]
Collaboration diagram for OpenGLBox:

Collaboration graph
[legend]

List of all members.

Public Member Functions

virtual void DisplayGL (Enum::DrawMode DM=Enum::POLYGON)
 OpenGLBox (Real xMin=-1.0, Real xMax=1.0, Real yMin=-1.0, Real yMax=1.0, Real zMin=-1.0, Real zMax=1.0)
 ~OpenGLBox ()

Private Attributes

Real m_rPt [8][3]


Detailed Description

Definition at line 17 of file TAPsOpenGLBox.hpp.


Constructor & Destructor Documentation

BEGIN_NAMESPACE_TAPs__OpenGL OpenGLBox::OpenGLBox ( Real  xMin = -1.0,
Real  xMax = 1.0,
Real  yMin = -1.0,
Real  yMax = 1.0,
Real  zMin = -1.0,
Real  zMax = 1.0 
)

Definition at line 19 of file TAPsOpenGLBox.cpp.

00020 {
00021     // Set the eight points of this box
00022     // xMin is the left side from the center of the box
00023     // xMax is the right side from the center of the box
00024     // yMin is the bottom side from the center of the box
00025     // yMax is the top side from the center of the box
00026     // zMin is the far side from the center of the box
00027     // zMax is the near side from the center of the box
00028     //     4-------5
00029     //    /|      /|
00030     //   / |     / |
00031     //  3--+----2  |
00032     //  |  7----+--6
00033     //  | /     | /
00034     //  |/      |/
00035     //  0-------1
00036     m_rPt[0][0] = xMin; m_rPt[0][1] = yMin; m_rPt[0][2] = zMax;
00037     m_rPt[1][0] = xMax; m_rPt[1][1] = yMin; m_rPt[1][2] = zMax;
00038     m_rPt[2][0] = xMax; m_rPt[2][1] = yMax; m_rPt[2][2] = zMax;
00039     m_rPt[3][0] = xMin; m_rPt[3][1] = yMax; m_rPt[3][2] = zMax;
00040     m_rPt[4][0] = xMin; m_rPt[4][1] = yMax; m_rPt[4][2] = zMin;
00041     m_rPt[5][0] = xMax; m_rPt[5][1] = yMax; m_rPt[5][2] = zMin;
00042     m_rPt[6][0] = xMax; m_rPt[6][1] = yMin; m_rPt[6][2] = zMin;
00043     m_rPt[7][0] = xMin; m_rPt[7][1] = yMin; m_rPt[7][2] = zMin;
00044 }

OpenGLBox::~OpenGLBox (  ) 

Definition at line 46 of file TAPsOpenGLBox.cpp.

00047 {}


Member Function Documentation

void OpenGLBox::DisplayGL ( Enum::DrawMode  DM = Enum::POLYGON  )  [virtual]

Definition at line 49 of file TAPsOpenGLBox.cpp.

00050 {
00051     //int ptSize[1];
00052     glColor3f( 1.0f, 1.0f, 1.0f );
00053 
00054     ApplyMaterial();
00055     
00056     // GL_QUAD_STRIP
00057     // V0-------V2-------V4-------V6
00058     // |        |         |        | 
00059     // |        |         |        |
00060     // |        |         |        |
00061     // V1-------V3-------V5-------V7
00062     glBegin( GL_QUAD_STRIP );
00063         glVertex3f( m_rPt[0][0], m_rPt[0][1], m_rPt[0][2] );    // V0
00064         glVertex3f( m_rPt[1][0], m_rPt[1][1], m_rPt[1][2] );    // V1
00065         glVertex3f( m_rPt[3][0], m_rPt[3][1], m_rPt[3][2] );    // V2
00066         glVertex3f( m_rPt[2][0], m_rPt[2][1], m_rPt[2][2] );    // V3
00067         glVertex3f( m_rPt[4][0], m_rPt[4][1], m_rPt[4][2] );    // V4
00068         glVertex3f( m_rPt[5][0], m_rPt[5][1], m_rPt[5][2] );    // V5
00069         glVertex3f( m_rPt[7][0], m_rPt[7][1], m_rPt[7][2] );    // V6
00070         glVertex3f( m_rPt[6][0], m_rPt[6][1], m_rPt[6][2] );    // V7
00071     glEnd();
00072     glBegin( GL_QUAD_STRIP );
00073         glVertex3f( m_rPt[3][0], m_rPt[3][1], m_rPt[3][2] );    // V0
00074         glVertex3f( m_rPt[4][0], m_rPt[4][1], m_rPt[4][2] );    // V1
00075         glVertex3f( m_rPt[0][0], m_rPt[0][1], m_rPt[0][2] );    // V2
00076         glVertex3f( m_rPt[7][0], m_rPt[7][1], m_rPt[7][2] );    // V3
00077         glVertex3f( m_rPt[1][0], m_rPt[1][1], m_rPt[1][2] );    // V4
00078         glVertex3f( m_rPt[6][0], m_rPt[6][1], m_rPt[6][2] );    // V5
00079         glVertex3f( m_rPt[2][0], m_rPt[2][1], m_rPt[2][2] );    // V6
00080         glVertex3f( m_rPt[5][0], m_rPt[5][1], m_rPt[5][2] );    // V7
00081     glEnd();
00082 
00083     /*
00084     switch (DM) {
00085         // Draw Points
00086         case OpenGL::POINT:
00087             // Set Point Size
00088             //glGetIntegerv( GL_POINT_SIZE, ptSize );
00089             //glPointSize( 2 );
00090             glBegin( GL_POINTS );
00091             for ( m = 0; m < m_iNoRows; m++ ) {
00092                 for ( n = 0; n < m_iNoCols; n++ ) {
00093                     glVertex3f( m_pcParticle[m][n]->m_vtPosit[0], 
00094                                 m_pcParticle[m][n]->m_vtPosit[1],
00095                                 m_pcParticle[m][n]->m_vtPosit[2] );
00096                 }
00097             }
00098             glEnd();
00099             // Restore Point Size
00100             //glPointSize( ptSize[0] );
00101             break;
00102 
00103         // Draw Wire Frame
00104         case OpenGL::WIRE_FRAME:
00105             // Draw Row Lines
00106             for ( m = 0; m < m_iNoRows; m++ ) {
00107                 glBegin( GL_LINE_STRIP );
00108                 for ( n = 0; n < m_iNoCols; n++ ) {
00109                     glVertex3f( m_pcParticle[m][n]->m_vtPosit[0], 
00110                                 m_pcParticle[m][n]->m_vtPosit[1],
00111                                 m_pcParticle[m][n]->m_vtPosit[2] );
00112                 }
00113                 glEnd();
00114             }
00115             // Draw Column Lines
00116             for ( n = 0; n < m_iNoCols; n++ ) {
00117                 glBegin( GL_LINE_STRIP );
00118                 for ( m = 0; m < m_iNoRows; m++ ) {
00119                     glVertex3f( m_pcParticle[m][n]->m_vtPosit[0], 
00120                                 m_pcParticle[m][n]->m_vtPosit[1],
00121                                 m_pcParticle[m][n]->m_vtPosit[2] );
00122                 }
00123                 glEnd();
00124             }
00125             // Draw Diagonal Lines
00126             glBegin( GL_LINES );
00127             for ( m = 0; m < m_iNoRows-1; m++ ) {
00128                 for ( n = 0; n < m_iNoCols-1; n++ ) {
00129                     // Draw a line from [m][n] --- [m+1][n+1]
00130                     glVertex3f( m_pcParticle[m][n]->m_vtPosit[0], 
00131                                 m_pcParticle[m][n]->m_vtPosit[1],
00132                                 m_pcParticle[m][n]->m_vtPosit[2] );
00133                     glVertex3f( m_pcParticle[m+1][n+1]->m_vtPosit[0], 
00134                                 m_pcParticle[m+1][n+1]->m_vtPosit[1],
00135                                 m_pcParticle[m+1][n+1]->m_vtPosit[2] );
00136                     // Draw a line from [m+1][n] to [m][n+1]
00137                     glVertex3f( m_pcParticle[m+1][n]->m_vtPosit[0], 
00138                                 m_pcParticle[m+1][n]->m_vtPosit[1],
00139                                 m_pcParticle[m+1][n]->m_vtPosit[2] );
00140                     glVertex3f( m_pcParticle[m][n+1]->m_vtPosit[0], 
00141                                 m_pcParticle[m][n+1]->m_vtPosit[1],
00142                                 m_pcParticle[m][n+1]->m_vtPosit[2] );
00143                 }
00144             }
00145             glEnd();
00146             break;
00147 
00148         // Draw Polygons
00149         case OpenGL::POLYGON:
00150             // With Texture
00151             if ( m_pcImg != NULL ) {
00152 
00153                 DrawTexture();
00154 
00155                 float tr, tc;
00156                 float trStep = 1.0 / (m_iNoRows-1);
00157                 float tcStep = 1.0 / (m_iNoCols-1);
00158                 for ( m = 0, tr = 1.0; m < m_iNoRows-1; m++, tr -= trStep ) {
00159                     glBegin( GL_QUAD_STRIP );
00160                     for ( n = 0, tc = 0.0; n < m_iNoCols; n++, tc += tcStep ) {
00161                         glTexCoord2f(tc, tr);
00162                         glVertex3f( m_pcParticle[m][n]->m_vtPosit[0], 
00163                                     m_pcParticle[m][n]->m_vtPosit[1],
00164                                     m_pcParticle[m][n]->m_vtPosit[2] );
00165                         glTexCoord2f(tc, tr-trStep);
00166                         glVertex3f( m_pcParticle[m+1][n]->m_vtPosit[0], 
00167                                     m_pcParticle[m+1][n]->m_vtPosit[1],
00168                                     m_pcParticle[m+1][n]->m_vtPosit[2] );
00169                     }
00170                     glEnd();
00171                 }
00172             }
00173             // Without Texture
00174             else {
00175                 for ( m = 0; m < m_iNoRows-1; m++ ) {
00176                     glBegin( GL_QUAD_STRIP );
00177                     for ( n = 0; n < m_iNoCols; n++ ) {
00178                         glVertex3f( m_pcParticle[m][n]->m_vtPosit[0], 
00179                                     m_pcParticle[m][n]->m_vtPosit[1],
00180                                     m_pcParticle[m][n]->m_vtPosit[2] );
00181                         glVertex3f( m_pcParticle[m+1][n]->m_vtPosit[0], 
00182                                     m_pcParticle[m+1][n]->m_vtPosit[1],
00183                                     m_pcParticle[m+1][n]->m_vtPosit[2] );
00184                     }
00185                     glEnd();
00186                 }
00187             }
00188             break;
00189     }
00190 
00191     // TEST
00192     //DisplayGL_ParticleNormals();
00193     glDisable( GL_LIGHTING );
00194     glColor3f( 0.0f, 1.0f, 0.0f );
00195     glPointSize( 7 );
00196     m = 0; n = 0;
00197     glBegin( GL_POINTS );
00198         glVertex3f( m_pcParticle[m][n]->m_vtPosit[0], 
00199                     m_pcParticle[m][n]->m_vtPosit[1],
00200                     m_pcParticle[m][n]->m_vtPosit[2] );
00201     glEnd();
00202     glColor3f( 0.0f, 1.0f, 1.0f );
00203     glPointSize( 5 );
00204     m = 0; n = 1;
00205     glBegin( GL_POINTS );
00206         glVertex3f( m_pcParticle[m][n]->m_vtPosit[0], 
00207                     m_pcParticle[m][n]->m_vtPosit[1],
00208                     m_pcParticle[m][n]->m_vtPosit[2] );
00209     glEnd();
00210     glPointSize( 1 );
00211     glEnable( GL_LIGHTING );
00212     */
00213 }


Member Data Documentation

Real OpenGLBox::m_rPt[8][3] [private]

Definition at line 33 of file TAPsOpenGLBox.hpp.


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

Generated on Mon Oct 13 11:45:41 2008 for TAPs by  doxygen 1.5.6