Changeset 20218

Show
Ignore:
Timestamp:
05/14/07 16:04:24 (1 year ago)
Author:
patrick
Message:

MFT r19938: Fixed coding standard violations. No functional changes.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • juggler/branches/2.0/modules/vrjuggler/vrj/Draw/Pf/PfDrawManager.cpp

    r19941 r20218  
    8080 
    8181// Draw Callbacks 
    82 void PfDrawFuncStereoLeft(pfChannel *chan, void* chandata); 
    83 void PfDrawFuncStereoRight(pfChannel *chan, void* chandata); 
    84 void PfDrawFuncMonoBackbuffer(pfChannel *chan, void* chandata); 
     82void PfDrawFuncStereoLeft(pfChannel* chan, void* chandata); 
     83void PfDrawFuncStereoRight(pfChannel* chan, void* chandata); 
     84void PfDrawFuncMonoBackbuffer(pfChannel* chan, void* chandata); 
    8585//void PfDrawFuncSimulator(pfChannel* chan, void* chandata); 
    86 //void PfAppFunc(pfChannel *chan, void* chandata); 
    87  
    88  
    89 void PfPipeSwapFunc(pfPipe *p, pfPipeWindow *pw); 
     86//void PfAppFunc(pfChannel* chan, void* chandata); 
     87 
     88 
     89void PfPipeSwapFunc(pfPipe* p, pfPipeWindow* pw); 
    9090 
    9191vprSingletonImp(PfDrawManager); 
     
    9494{ 
    9595   //TODO: Add thread safety. 
    96    for ( std::vector<PfInputHandler*>::iterator itr = mPfInputHandlers.begin()
    97          itr != mPfInputHandlers.end() ; itr++
     96   typedef std::vector<PfInputHandler*>::iterator iter_type
     97   for ( iter_type itr = mPfInputHandlers.begin(); itr != mPfInputHandlers.end(); ++itr
    9898   { 
    9999      delete *itr; 
     
    123123   // pipes when creating a new display_system element is 0. It needs to be this 
    124124   // because we can not fill in the list of pipes with default values. 
    125    if(mNumPipes < 1
     125   if ( mNumPipes < 1
    126126   { 
    127127      mNumPipes = 1; 
    128128   } 
    129129 
    130    for (unsigned int i=0;i<mNumPipes;i++
     130   for ( unsigned int i = 0; i < mNumPipes; ++i
    131131   { 
    132132      std::string cur_disp_name = "-1"; 
    133133 
    134       // NOTE: ConfigElements return the default value for a property if a value is 
    135       //       not present. So if a pipe string is not specified for this pipe then 
    136       //       it gets the default value of "-1". 
     134      // NOTE: ConfigElements return the default value for a property if a 
     135      //       value is not present. So if a pipe string is not specified for 
     136      //       this pipe then it gets the default value of "-1". 
    137137      mPipeStrs.push_back(element->getProperty<std::string>("x11_pipes", i)); 
    138138 
    139       if(mPipeStrs[i] == cur_disp_name)    // Use display env 
     139      if ( mPipeStrs[i] == cur_disp_name )    // Use display env 
    140140      { 
    141141         std::string display_env; 
     
    152152         << vprDEBUG_FLUSH; 
    153153   } 
     154 
    154155   return true; 
    155156} 
     
    179180   pfFrame(); 
    180181 
    181    for (std::vector<PfInputHandler*>::iterator itr = mPfInputHandlers.begin()
    182         itr != mPfInputHandlers.end() ; itr++
     182   typedef std::vector<PfInputHandler*>::iterator iter_type
     183   for ( iter_type itr = mPfInputHandlers.begin(); itr != mPfInputHandlers.end(); ++itr
    183184   { 
    184185      (*itr)->checkEvents(); 
    185186   } 
    186187} 
    187  
    188188 
    189189// XXX: Hack for now 
     
    193193   //    for(each viewport) 
    194194   //       for(each channel) 
    195    for(unsigned int dispIndex=0;dispIndex<mDisplays.size();dispIndex++
    196    { 
    197       for(unsigned vp=0;vp<mDisplays[dispIndex].viewports.size();vp++
    198       { 
    199          for(unsigned ch=0;ch<2;ch++
     195   for ( unsigned int dispIndex = 0; dispIndex < mDisplays.size(); ++dispIndex
     196   { 
     197      for ( unsigned int vp = 0; vp < mDisplays[dispIndex].viewports.size(); ++vp
     198      { 
     199         for ( unsigned int ch = 0; ch < 2; ++ch
    200200         { 
    201             if(mDisplays[dispIndex].viewports[vp].chans[ch] != NULL) 
     201            if ( mDisplays[dispIndex].viewports[vp].chans[ch] != NULL ) 
     202            { 
    202203               mApp->appChanFunc(mDisplays[dispIndex].viewports[vp].chans[ch]); 
     204            } 
    203205         } 
    204206      } 
    205207   } 
    206208} 
    207  
    208209 
    209210/** 
     
    212213 * @post dynamic_cast<> of the app to a Pf app. 
    213214 */ 
    214 void PfDrawManager::setApp(App* _app) 
     215void PfDrawManager::setApp(App* app) 
    215216{ 
    216217   //vprASSERT(app != NULL); 
    217    mApp = dynamic_cast<PfApp*>(_app); 
    218    if(mPfHasForked) 
    219       initAppGraph();         // If pf is already started, then intialize the app scene graph 
    220  
     218   mApp = dynamic_cast<PfApp*>(app); 
     219 
     220   // If pf is already started, then intialize the app scene graph. 
     221   if ( mPfHasForked ) 
     222   { 
     223      initAppGraph(); 
     224   } 
    221225} 
    222226 
     
    232236   pfuInitUtil(); 
    233237    
    234    // XXX: This call should really be triggered by a change in draw manager or something 
     238   // XXX: This call should really be triggered by a change in draw manager or 
     239   // something. 
    235240   vprASSERT(mDisplayManager != NULL); 
    236    configDisplaySystem(mDisplayManager->getDisplaySystemElement());    // Configure all the display system stuff 
     241 
     242   // Configure all the display system stuff. 
     243   configDisplaySystem(mDisplayManager->getDisplaySystemElement()); 
    237244 
    238245   mApp->preForkInit(); 
     
    252259#else 
    253260   // If we are running in a cluster then we must run in single process mode. 
    254    if(jccl::ConfigManager::instance()->isElementTypeInPendingList("cluster_manager") || 
    255       jccl::ConfigManager::instance()->isElementTypeInActiveList("cluster_manager")
     261   if ( jccl::ConfigManager::instance()->isElementTypeInPendingList("cluster_manager") || 
     262      jccl::ConfigManager::instance()->isElementTypeInActiveList("cluster_manager")
    256263   { 
    257264      vprDEBUG_BEGIN(vrjDBG_DRAW_MGR, vprDBG_STATE_LVL) 
     
    269276#endif 
    270277 
    271 // We can not init head and wand model loaders since they are loaded in PfBasicSimInterface 
     278   // We can not init head and wand model loaders since they are loaded in 
     279   // PfBasicSimInterface. 
    272280//   initLoaders();          // Must call before pfConfig 
    273281 
     
    281289 
    282290   // Initialize the pipes that the system may need 
    283    // If we don't do this, then pf automatically give each pipe a big black channel 
     291   // If we don't do this, then pf automatically give each pipe a big black 
     292   // channel. 
    284293   initPipes(); 
    285294 
    286295   initPerformerGraph();        // Create the other scene graph nodes 
    287    if(mApp != NULL) 
     296   if ( NULL != mApp ) 
     297   { 
    288298      initAppGraph();           // App was already set, but pf was not loaded.  So load graph now 
    289  
     299   } 
    290300 
    291301   vprASSERT(mRoot != NULL && "We have a NULL root in PfDrawManager"); 
    292    vprASSERT(mRootWithSim != NULL && "We have a NULL sim root scene in PfDrawManager"); 
    293    vprASSERT(mSceneRoot != NULL && "We have a NULL root scene in PfDrawManager"); 
     302   vprASSERT(mRootWithSim != NULL && 
     303             "We have a NULL sim root scene in PfDrawManager"); 
     304   vprASSERT(mSceneRoot != NULL && 
     305             "We have a NULL root scene in PfDrawManager"); 
    294306 
    295307   //pfFrame(); 
     
    306318 * Gets a Performer pipe. 
    307319 * 
    308  * @pre pipe_num < mNumPipes 
     320 * @pre pipeNum < mNumPipes 
    309321 *       Fork must have happened. 
    310322 */ 
    311 pfPipe* PfDrawManager::getPfPipe(unsigned pipe_num) 
     323pfPipe* PfDrawManager::getPfPipe(unsigned int pipeNum) 
    312324{ 
    313325   vprASSERT((mPfHasForked) && "Tried to get pipe before forking happened"); 
    314    vprASSERT((pipe_num < mNumPipes) && "Tried to request out of bounds pipe"); 
    315    vprASSERT((pipe_num < mPipes.size()) && "Tried to get out of range pipe"); 
    316    vprASSERT((NULL != mPipes[pipe_num]) && "Have NULL pipe"); 
     326   vprASSERT((pipeNum < mNumPipes) && "Tried to request out of bounds pipe"); 
     327   vprASSERT((pipeNum < mPipes.size()) && "Tried to get out of range pipe"); 
     328   vprASSERT((NULL != mPipes[pipeNum]) && "Have NULL pipe"); 
    317329 
    318330   // Print an error message if an invalid pipe was requested.  This will 
    319331   // probably only happen when a configuration is broken. 
    320    if ( pipe_num >= mNumPipes || pipe_num >= mPipes.size() || 
    321         NULL == mPipes[pipe_num] ) 
     332   if ( pipeNum >= mNumPipes || pipeNum >= mPipes.size() || 
     333        NULL == mPipes[pipeNum] ) 
    322334   { 
    323335      vprDEBUG(vprDBG_ERROR, vprDBG_CRITICAL_LVL) 
    324336         << clrOutNORM(clrRED, "ERROR") 
    325          << ": Invalid pipe number (" << pipe_num << ") requested.  " 
     337         << ": Invalid pipe number (" << pipeNum << ") requested.  " 
    326338         << "Check display system configuration.\n" << vprDEBUG_FLUSH; 
    327339      return NULL; 
     
    330342   { 
    331343      // Return the actual pipe 
    332       return mPipes[pipe_num]; 
     344      return mPipes[pipeNum]; 
    333345   } 
    334346} 
     
    341353   mPipes.resize(mNumPipes, NULL);     // Resize the vector 
    342354 
    343    for(unsigned pipe_num=0; pipe_num<mNumPipes; pipe_num++
     355   for ( unsigned int pipe_num = 0; pipe_num < mNumPipes; ++pipe_num
    344356   { 
    345357      vprDEBUG(vrjDBG_DRAW_MGR, vprDBG_CONFIG_LVL) 
     
    355367 
    356368      pfPipeWindow* pw = allocatePipeWin(pipe_num);   // new pfPipeWindow(mPipes[pipe_num]); 
    357       pw->setOriginSize(0,0,1,1); 
     369      pw->setOriginSize(0, 0, 1, 1); 
    358370 
    359371      // XXX: Set the swap func 
    360       mPipes[pipe_num]->setSwapFunc( PfPipeSwapFunc );      // Set to the given swap func 
     372      mPipes[pipe_num]->setSwapFunc(PfPipeSwapFunc);  // Set to the given swap func 
    361373   } 
    362374} 
     
    371383{ 
    372384   vprASSERT(disp != NULL);    // Can't add a null display 
    373    vprASSERT((true == mPfHasForked) && "Trying to add display when performer has not been initialized"); 
     385   vprASSERT(mPfHasForked && 
     386             "Trying to add display when performer has not been initialized"); 
    374387 
    375388   //  For the display 
     
    414427   // Setup window border 
    415428   if (disp->shouldDrawBorder()) 
     429   { 
    416430      pf_disp.pWin->setName(disp->getName().c_str()); // Give the window a name 
     431   } 
    417432   else 
    418       pf_disp.pWin->setMode(PFWIN_NOBORDER, 1);          // Get rid of that border 
     433   { 
     434      pf_disp.pWin->setMode(PFWIN_NOBORDER, 1);       // Get rid of that border 
     435   } 
    419436 
    420437   jccl::ConfigElementPtr fb_elt = disp->getGlFrameBufferConfig(); 
     
    490507   //   - Setup master chans 
    491508   Viewport* viewport = NULL; 
    492    unsigned num_vps = disp->getNumViewports(); 
     509   const unsigned int num_vps = disp->getNumViewports(); 
    493510 
    494511   vprDEBUG(vrjDBG_DRAW_MGR, vprDBG_CONFIG_LVL) 
    495512      << "   Num viewports: " << num_vps << std::endl << vprDEBUG_FLUSH; 
    496513 
    497    for(unsigned vp_num=0; vp_num < num_vps; vp_num++
     514   for ( unsigned int vp_num = 0; vp_num < num_vps; ++vp_num
    498515   { 
    499516      viewport = disp->getViewport(vp_num); 
    500517 
    501       if(viewport->isActive())      // is viewport active 
     518      if ( viewport->isActive() )      // is viewport active 
    502519      { 
    503520         //Viewport::View view = viewport->getView(); 
    504          pfViewport pf_viewport;                         // The viewport to build up 
     521         pfViewport pf_viewport;                  // The viewport to build up 
    505522         pf_viewport.viewport = viewport; 
    506523         float vp_ox, vp_oy, vp_sx, vp_sy; 
     
    510527         viewport->getOriginAndSize(vp_ox, vp_oy, vp_sx, vp_sy); 
    511528         pf_viewport.chans[pfViewport::PRIMARY] = new pfChannel(pipe); 
    512          pf_viewport.chans[pfViewport::PRIMARY]->setViewport(vp_ox, vp_ox+vp_sx, vp_oy, vp_oy+vp_sy); 
     529         pf_viewport.chans[pfViewport::PRIMARY]->setViewport(vp_ox, 
     530                                                             vp_ox + vp_sx, 
     531                                                             vp_oy, 
     532                                                             vp_oy + vp_sy); 
    513533         pf_disp.pWin->addChan(pf_viewport.chans[pfViewport::PRIMARY]); 
    514534 
    515535         // Secondary channel - (Right in stereo) 
    516          if(disp->isStereoRequested()
     536         if ( disp->isStereoRequested()
    517537         { 
    518538            pf_viewport.chans[pfViewport::SECONDARY] = new pfChannel(pipe); 
    519             pf_viewport.chans[pfViewport::SECONDARY]->setViewport(vp_ox, vp_ox+vp_sx, vp_oy, vp_oy+vp_sy); 
     539            pf_viewport.chans[pfViewport::SECONDARY]->setViewport(vp_ox, 
     540                                                                  vp_ox + vp_sx, 
     541                                                                  vp_oy, 
     542                                                                  vp_oy + vp_sy); 
    520543            pf_disp.pWin->addChan(pf_viewport.chans[pfViewport::SECONDARY]); 
    521544         } 
    522545 
    523546         // Set draw function 
    524          if(disp->isStereoRequested()
     547         if ( disp->isStereoRequested()
    525548         { 
    526             pf_viewport.chans[pfViewport::PRIMARY]->setTravFunc(PFTRAV_DRAW, PfDrawFuncStereoLeft); 
    527             pf_viewport.chans[pfViewport::SECONDARY]->setTravFunc(PFTRAV_DRAW, PfDrawFuncStereoRight); 
     549            pf_viewport.chans[pfViewport::PRIMARY]->setTravFunc(PFTRAV_DRAW, 
     550                                                                PfDrawFuncStereoLeft); 
     551            pf_viewport.chans[pfViewport::SECONDARY]->setTravFunc(PFTRAV_DRAW, 
     552                                                                  PfDrawFuncStereoRight); 
    528553         } 
    529554         else 
    530555         { 
    531             pf_viewport.chans[pfViewport::PRIMARY]->setTravFunc(PFTRAV_DRAW, PfDrawFuncMonoBackbuffer); 
     556            pf_viewport.chans[pfViewport::PRIMARY]->setTravFunc(PFTRAV_DRAW, 
     557                                                                PfDrawFuncMonoBackbuffer); 
    532558         } 
    533559 
    534560         // if surface ==> Setup surface channels 
    535          if (viewport->isSurface()
     561         if ( viewport->isSurface()
    536562         { 
    537563            vprASSERT(pf_viewport.chans[pfViewport::PRIMARY] != NULL); 
    538564 
    539565            // Primary 
    540             if(NULL == mSurfMasterChan)      // If NULL, then add us as the new one 
     566            if ( NULL == mSurfMasterChan )      // If NULL, then add us as the new one 
    541567            { 
    542568               mSurfMasterChan = pf_viewport.chans[pfViewport::PRIMARY]; 
     
    552578 
    553579            // Secondary 
    554             if(NULL != pf_viewport.chans[pfViewport::SECONDARY]
     580            if ( NULL != pf_viewport.chans[pfViewport::SECONDARY]
    555581            { 
    556582               mSurfChannels.push_back(pf_viewport.chans[pfViewport::SECONDARY]); 
    557583               mSurfMasterChan->attach(pf_viewport.chans[pfViewport::SECONDARY]); 
    558584            } 
    559  
    560585         } 
    561586         // if sim ==> setup sim channels 
    562          else if(viewport->isSimulator()
     587         else if ( viewport->isSimulator()
    563588         { 
    564589            // -- Finish Simulator setup 
     
    572597 
    573598            // Create the simulator stuff 
    574             vprASSERT(1 == vp_element->getNum("simulator_plugin") && "You must supply a simulator plugin."); 
     599            vprASSERT(1 == vp_element->getNum("simulator_plugin") && 
     600                      "You must supply a simulator plugin."); 
    575601 
    576602            jccl::ConfigElementPtr sim_element = 
     
    595621 
    596622            // Primary 
    597             if(NULL == mSimMasterChan)        // If NULL, then make us the master 
     623            if ( NULL == mSimMasterChan )        // If NULL, then make us the master 
    598624            { 
    599625               mSimMasterChan = pf_viewport.chans[pfViewport::PRIMARY]; 
     
    609635 
    610636            // Secondary 
    611             if(NULL != pf_viewport.chans[pfViewport::SECONDARY]
     637            if ( NULL != pf_viewport.chans[pfViewport::SECONDARY]
    612638            { 
    613639               mSimChannels.push_back(pf_viewport.chans[pfViewport::SECONDARY]); 
     
    618644         // Add viewport to the display list 
    619645         pf_disp.viewports.push_back(pf_viewport); 
    620  
    621646      }  // is viewport active 
    622647   }     // for each viewport 
     
    634659   // Performer says that if you trigger a window from the applciation proccess 
    635660   // you must wait for the window to open during the draw process. 
    636    while( !pfIsPWinOpen( pf_disp.pWin ) ) 
     661   while ( ! pfIsPWinOpen(pf_disp.pWin) ) 
    637662   { 
    638663      pfFrame(); 
    639       vpr::System::usleep( 500 );  
    640    } 
    641  
    642    PfInputHandler* new_input_handler = new PfInputHandler(pf_disp.pWin, disp->getName()); 
     664      vpr::System::usleep(500);  
     665   } 
     666 
     667   PfInputHandler* new_input_handler = 
     668      new PfInputHandler(pf_disp.pWin, disp->getName()); 
    643669    
    644670   // Configure the Performer window to accept events. 
     
    646672   new_input_handler->config(display_elt, disp); 
    647673 
    648     
    649674   mPfInputHandlers.push_back(new_input_handler); 
    650675 
    651    if(pf_disp.disp->shouldHideMouse()
     676   if ( pf_disp.disp->shouldHideMouse()
    652677   { 
    653678      pfuLoadPWinCursor(pf_disp.pWin, PFU_CURSOR_OFF); 
     
    685710*/ 
    686711 
    687  
    688  
    689  
    690712/** 
    691713 * Callback when display is removed to display manager. 
     
    709731   } 
    710732#else 
    711    std::vector<pfDisplay>::iterator disp_i = std::find_if(mDisplays.begin(), mDisplays.end(), 
    712                          std::compose1( std::bind2nd( std::equal_to<Display*>(),disp), 
    713                                         pfDisplay_disp()) ); 
     733   std::vector<pfDisplay>::iterator disp_i = 
     734      std::find_if(mDisplays.begin(), mDisplays.end(), 
     735                   std::compose1(std::bind2nd(std::equal_to<Display*>(), disp), 
     736                                 pfDisplay_disp())); 
    714737#endif 
    715738 
    716  
    717    if(mDisplays.end() == disp_i) 
     739   if ( mDisplays.end() == disp_i ) 
    718740   { 
    719741      vprDEBUG(vrjDBG_DRAW_MGR, vprDBG_CRITICAL_LVL) 
     
    723745   } 
    724746 
    725  
    726747   // Release the pfDisplay 
    727748   releaseDisplay(*disp_i); 
     
    734755{ 
    735756   // Release all viewports 
    736    for(std::vector<pfViewport>::iterator i=disp.viewports.begin(); i != disp.viewports.end(); i++) 
     757   typedef std::vector<pfViewport>::iterator iter_type; 
     758   for ( iter_type i = disp.viewports.begin(); i != disp.viewports.end(); ++i ) 
    737759   { 
    738760      releaseViewport(disp, *i); 
     
    743765} 
    744766 
    745  
    746767void PfDrawManager::releaseViewport(pfDisplay& disp, pfViewport& vp) 
    747768{ 
     
    749770 
    750771   // Release the channel stuff 
    751    for(int i=0;i<2;i++
     772   for ( int i = 0; i < 2; ++i
    752773   { 
    753774      pfChannel* chan = vp.chans[i]; 
    754775 
    755776      // if we have a channel to delete 
    756       if(chan != NULL
    757       { 
    758          if(vp.viewport->isSurface())         // SURFACE display 
     777      if ( chan != NULL
     778      { 
     779         if ( vp.viewport->isSurface() )         // SURFACE display 
    759780         { 
    760781            // Remove the channel from the list of channels 
    761             chan_i = std::find(mSurfChannels.begin(), mSurfChannels.end(), chan); 
    762             if(chan_i == mSurfChannels.end()) 
     782            chan_i = std::find(mSurfChannels.begin(), mSurfChannels.end(), 
     783                               chan); 
     784 
     785            if ( chan_i == mSurfChannels.end() ) 
    763786            { 
    764787               vprASSERT(false && "Trying to remove a non-existant channel"); 
     
    769792 
    770793            // Check if we were the master 
    771             if(chan == mSurfMasterChan
     794            if ( chan == mSurfMasterChan
    772795            { 
    773                mSurfMasterChan = NULL;                      // Get new master channel 
    774                if(mSurfChannels.size() > 0) 
     796               mSurfMasterChan = NULL;              // Get new master channel 
     797               if ( mSurfChannels.size() > 0 ) 
     798               { 
    775799                  mSurfMasterChan = mSurfChannels[0]; 
     800               } 
    776801            } 
    777802 
    778             if(mSurfMasterChan != NULL)                  // Dettach from the channel 
     803            if ( mSurfMasterChan != NULL )          // Dettach from the channel 
     804            { 
    779805               chan->detach(mSurfMasterChan); 
     806            } 
    780807         } 
    781          else if(vp.viewport->isSimulator())    // SIMULATOR display 
     808         else if ( vp.viewport->isSimulator() )    // SIMULATOR display 
    782809         { 
    783810            // Remove the channel from the list of channels 
    784811            chan_i = std::find(mSimChannels.begin(), mSimChannels.end(), chan); 
    785             if(chan_i == mSimChannels.end()
     812            if ( chan_i == mSimChannels.end()
    786813            { 
    787814               vprASSERT(false && "Trying to remove a non-existant channel"); 
     
    792819 
    793820            // Check if we were the master 
    794             if(chan == mSimMasterChan
     821            if ( chan == mSimMasterChan
    795822            { 
    796                mSimMasterChan = NULL;                      // Get new master channel 
    797                if(mSimChannels.size() > 0) 
     823               mSimMasterChan = NULL;             // Get new master channel 
     824               if ( mSimChannels.size() > 0 ) 
     825               { 
    798826                  mSimMasterChan = mSimChannels[0]; 
     827               } 
    799828            } 
    800829 
    801             if(mSimMasterChan != NULL)                  // Dettach from the channel 
     830            if ( mSimMasterChan != NULL )         // Dettach from the channel 
     831            { 
    802832               chan->detach(mSimMasterChan); 
     833            } 
    803834         } 
    804835 
    805836         chan->setScene(NULL); 
    806837         disp.pWin->removeChan(chan);     // Remove channel from pwin 
    807          pfDelete( chan);                     // Delete the channel 
    808       } 
    809    } 
    810 
    811  
    812  
     838         pfDelete(chan);                  // Delete the channel 
     839      } 
     840   } 
     841
    813842 
    814843// Get a pipe window to use 
    815 // This either allocates a new pipe window or grabs an unused one that was previously released 
    816 pfPipeWindow* PfDrawManager::allocatePipeWin(unsigned pipeNum) 
     844// This either allocates a new pipe window or grabs an unused one that was 
     845// previously released 
     846pfPipeWindow* PfDrawManager::allocatePipeWin(const unsigned int pipeNum) 
    817847{ 
    818848   pfPipeWindow* ret_val; 
     
    824854   } 
    825855 
    826    if(mPipeWindows[pipeNum].size() > 0)   // Is one available 
     856   if ( mPipeWindows[pipeNum].size() > 0 )   // Is one available 
    827857   { 
    828858      ret_val = mPipeWindows[pipeNum].back(); 
     
    831861   else 
    832862   { 
    833       ret_val = new pfPipeWindow(getPfPipe(pipeNum));         // Allocate a new one 
     863      ret_val = new pfPipeWindow(getPfPipe(pipeNum));    // Allocate a new one 
    834864   } 
    835865 
     
    840870 
    841871// Just store the old pipe window in the list 
    842 void PfDrawManager::releasePipeWin(pfPipeWindow* pipeWin, unsigned pipeNum) 
     872void PfDrawManager::releasePipeWin(pfPipeWindow* pipeWin, 
     873                                   const unsigned int pipeNum) 
    843874{ 
    844875   mPipeWindows[pipeNum].push_back(pipeWin); 
    845876} 
    846  
    847  
    848877 
    849878// Initialize the parameters of the master channel 
     
    864893   // Set the Channel attribs based on cur settings 
    865894   // 
    866    unsigned cur_share = masterChan->getShare();          // Get current setting, and OR the new stuff on 
    867    unsigned turn_on = ( PFCHAN_NEARFAR | PFCHAN_EARTHSKY | 
    868                         PFCHAN_STRESS | PFCHAN_LOD | PFCHAN_SWAPBUFFERS | 
    869                         PFCHAN_APPFUNC | PFCHAN_SCENE | PFCHAN_CULLFUNC | 
    870                         PFCHAN_STATS_DRAWMODE); 
    871    unsigned turn_off = (   PFCHAN_FOV | 
    872                            PFCHAN_VIEW | 
    873                            PFCHAN_VIEW_OFFSETS | 
    874                            PFCHAN_DRAWFUNC ); 
    875  
    876    masterChan->setShare((cur_share | turn_on) &(~turn_off)); 
     895   const unsigned int cur_share = masterChan->getShare();  // Get current setting, and OR the new stuff on 
     896   const unsigned int turn_on = PFCHAN_NEARFAR | PFCHAN_EARTHSKY | 
     897                                PFCHAN_STRESS | PFCHAN_LOD | 
     898                                PFCHAN_SWAPBUFFERS | PFCHAN_APPFUNC | 
     899                                PFCHAN_SCENE | PFCHAN_CULLFUNC | 
     900                                PFCHAN_STATS_DRAWMODE; 
     901   const unsigned int turn_off = PFCHAN_FOV | 
     902                                 PFCHAN_VIEW | 
     903                                 PFCHAN_VIEW_OFFSETS | 
     904                                 PFCHAN_DRAWFUNC; 
     905 
     906   masterChan->setShare((cur_share | turn_on) & ~turn_off); 
    877907 
    878908   //masterChan->setTravFunc(PFTRAV_APP, PfAppFunc); 
     
    881911   //                     PFCHAN_APPFUNC | PFCHAN_CULLFUNC ); 
    882912} 
    883  
    884913 
    885914/** Returns the needed mono frame buffer config. */ 
     
    11891218   mRootWithSim = new pfScene; 
    11901219 
    1191    mSceneGroup = new pfGroup;                // (Placeholder until app loads theirs) 
     1220   mSceneGroup = new pfGroup;           // (Placeholder until app loads theirs) 
    11921221   mRoot->addChild(mSceneGroup);        // Create the base scene without sim 
    1193    mRootWithSim->addChild(mSceneGroup);      // Create base scene with sim 
     1222   mRootWithSim->addChild(mSceneGroup); // Create base scene with sim 
    11941223} 
    11951224 
     
    12011230{ 
    12021231   mApp->initScene(); 
    1203    if(mSceneRoot != NULL) 
     1232   if ( NULL != mSceneRoot ) 
     1233   { 
    12041234      mSceneGroup->removeChild(mSceneRoot); 
     1235   } 
    12051236 
    12061237   mSceneRoot = mApp->getScene(); 
     
    12301261   //   for(each viewport) 
    12311262   //       update Performer specific stuff. 
    1232    for (unsigned disp_id=0;disp_id<mDisplays.size();disp_id++)    // each display 
     1263   for ( unsigned int disp_id = 0; disp_id < mDisplays.size(); ++disp_id )    // each display 
    12331264   { 
    12341265      pfDisplay* cur_disp = &(mDisplays[disp_id]); 
    12351266 
    12361267      vprASSERT(cur_disp->disp != NULL); 
    1237       for(unsigned vp=0;vp<cur_disp->viewports.size();vp++)       // each viewport 
     1268      for ( unsigned int vp = 0; vp < cur_disp->viewports.size(); ++vp )      // each viewport 
    12381269      { 
    12391270         pfViewport* pf_vp = &(cur_disp->viewports[vp]); 
     
    12501281         // --- All viewports --- // 
    12511282         //surf_vp = dynamic_cast<SurfaceViewport*>(pf_vp->viewport); 
    1252          //vprASSERT(surf_vp != NULL && "Could not cast supposedly surface display to SurfaceDisplay."); 
     1283         //vprASSERT(surf_vp != NULL && 
     1284         //          "Could not cast supposedly surface display to SurfaceDisplay."); 
    12531285         view = cur_vp->getView(); 
    12541286 
    1255          if(Viewport::LEFT_EYE == view
     1287         if ( Viewport::LEFT_EYE == view
    12561288         { 
    1257             updatePfProjection(pf_vp->chans[pfViewport::PRIMARY], cur_vp->getLeftProj()); 
     1289            updatePfProjection(pf_vp->chans[pfViewport::PRIMARY], 
     1290                               cur_vp->getLeftProj()); 
    12581291         } 
    1259          else if(Viewport::RIGHT_EYE == view
     1292         else if ( Viewport::RIGHT_EYE == view
    12601293         { 
    1261             updatePfProjection(pf_vp->chans[pfViewport::PRIMARY], cur_vp->getRightProj()); 
     1294            updatePfProjection(pf_vp->chans[pfViewport::PRIMARY], 
     1295                               cur_vp->getRightProj()); 
    12621296         } 
    1263          else if(Viewport::STEREO == view
     1297         else if ( Viewport::STEREO == view
    12641298         { 
    1265             updatePfProjection(pf_vp->chans[pfViewport::PRIMARY], cur_vp->getLeftProj()); 
    1266             updatePfProjection(pf_vp->chans[pfViewport::SECONDARY], cur_vp->getRightProj()); 
     1299            updatePfProjection(pf_vp->chans[pfViewport::PRIMARY], 
     1300                               cur_vp->getLeftProj()); 
     1301            updatePfProjection(pf_vp->chans[pfViewport::SECONDARY], 
     1302                               cur_vp->getRightProj()); 
    12671303         } 
    12681304         else 
     
    12721308 
    12731309         // Sim viewport 
    1274          if(cur_vp->isSimulator()
     1310         if ( cur_vp->isSimulator()
    12751311         { 
    12761312            SimViewport*      sim_vp(NULL); 
     
    12781314 
    12791315            sim_vp = dynamic_cast<SimViewport*>(pf_vp->viewport); 
    1280             vprASSERT(sim_vp != NULL && "Could not cast supposed simulator display to SimDisplay."); 
     1316            vprASSERT(sim_vp != NULL && 
     1317                      "Could not cast supposed simulator display to SimDisplay."); 
    12811318 
    12821319            draw_sim_i = dynamic_cast<PfSimInterface*>(sim_vp->getDrawSimInterface()); 
     
    12851322            draw_sim_i->updateSimulatorSceneGraph(); 
    12861323         } 
    1287  
    12881324      } 
    12891325   } 
     
    13621398{ 
    13631399   // Search surface displays 
    1364    for(unsigned int i=0;i<mSurfDisps.size();i++
     1400   for ( unsigned int i = 0; i < mSurfDisps.size(); ++i
    13651401   { 
    13661402      pfChannel* primary_chan = mSurfDisps[i].chans[pfDisp::PRIMARY]; 
    13671403      pfChannel* secondary_chan = mSurfDisps[i].chans[pfDisp::SECONDARY]; 
    1368       if((chan == primary_chan) || (chan == secondary_chan)) 
    1369          return &(mSurfDisps[i]); 
     1404      if ( chan == primary_chan || chan == secondary_chan ) 
     1405      { 
     1406         return &mSurfDisps[i]; 
     1407      } 
    13701408   } 
    13711409 
    13721410   // Search simulator displays 
    1373    for(unsigned int i=0;i<mSimDisps.size();i++
     1411   for ( unsigned int i = 0; i < mSimDisps.size(); ++i
    13741412   { 
    13751413      pfChannel* primary_chan = mSimDisps[i].chans[pfDisp::PRIMARY]; 
    13761414      pfChannel* secondary_chan = mSimDisps[i].chans[pfDisp::SECONDARY]; 
    1377       if((chan == primary_chan) || (chan == secondary_chan)) 
    1378          return &(mSimDisps[i]); 
     1415      if ( chan == primary_chan || chan == secondary_chan ) 
     1416      { 
     1417         return &mSimDisps[i]; 
     1418      } 
    13791419   } 
    13801420 
     
    13831423*/ 
    13841424 
    1385 void PfDrawManager::debugDump(int debugLevel) 
     1425void PfDrawManager::debugDump(const int debugLevel) 
    13861426{ 
    13871427   vprDEBUG_BEGIN(vrjDBG_DRAW_MGR, debugLevel) 
     
    13911431      << vprDEBUG_FLUSH; 
    13921432   vprDEBUG_NEXT(vrjDBG_DRAW_MGR, debugLevel) 
    1393       << "App: 0x" << std::hex << (void*)mApp << std::dec << std::endl 
     1433      << "App: 0x" << std::hex << (void*) mApp << std::dec << std::endl 
    13941434      << vprDEBUG_FLUSH; 
    13951435   vprDEBUG_NEXT(vrjDBG_DRAW_MGR, debugLevel) 
    1396       << "Scene: 0x" << std::hex << (void*)mRoot << std::dec << std::endl 
     1436      << "Scene: 0x" << std::hex << (void*) mRoot << std::dec << std::endl 
    13971437      << vprDEBUG_FLUSH; 
    13981438   vprDEBUG_NEXT(vrjDBG_DRAW_MGR, debugLevel) 
    1399       << "Sim scene: 0x" << std::hex << (void*)mRootWithSim << std::dec 
     1439      << "Sim scene: 0x" << std::hex << (void*) mRootWithSim << std::dec 
    14001440      << std::endl << vprDEBUG_FLUSH; 
    14011441   vprDEBUG_NEXT(vrjDBG_DRAW_MGR, debugLevel) 
     
    14031443      << vprDEBUG_FLUSH; 
    14041444 
    1405    for (std::vector<pfDisplay>::iterator i = mDisplays.begin(); i != mDisplays.end(); i++) 
     1445   typedef std::vector<pfDisplay>::iterator iter_type; 
     1446   for ( iter_type i = mDisplays.begin(); i != mDisplays.end(); ++i ) 
    14061447   { 
    14071448      debugDumpPfDisp(&(*i),debugLevel); 
     
    14121453} 
    14131454 
    1414  
    1415 void PfDrawManager::debugDumpPfDisp(pfDisplay* pf_disp, int debugLevel) 
     1455void PfDrawManager::debugDumpPfDisp(pfDisplay* pfDisp, const int debugLevel) 
    14161456{ 
    14171457   vprDEBUG_BEGIN(vrjDBG_DRAW_MGR, debugLevel) 
    1418       << "Display: 0x" << std::hex << (void*) pf_disp->disp << std::dec 
     1458      << "Display: 0x" << std::hex << (void*) pfDisp->disp << std::dec 
    14191459      << std::endl << vprDEBUG_FLUSH; 
    1420    vprDEBUG_NEXT(vrjDBG_DRAW_MGR,debugLevel) 
    1421       << "pWin: 0x" << std::hex << (void*) pf_disp->pWin << std::dec 
     1460   vprDEBUG_NEXT(vrjDBG_DRAW_MGR, debugLevel) 
     1461      << "pWin: 0x" << std::hex << (void*) pfDisp->pWin << std::dec 
    14221462      << std::endl << vprDEBUG_FLUSH; 
    1423    vprDEBUG_NEXT(vrjDBG_DRAW_MGR,debugLevel) 
    1424       << "visual ID: 0x" << std::hex << pf_disp->pWin->getFBConfigId() 
     1463   vprDEBUG_NEXT(vrjDBG_DRAW_MGR, debugLevel) 
     1464      << "visual ID: 0x" << std::hex << pfDisp->pWin->getFBConfigId() 
    14251465      << std::dec << std::endl << vprDEBUG_FLUSH; 
    14261466 
    1427    for(unsigned vp=0; vp<pf_disp->viewports.size(); ++vp) 
    1428    { 
    1429       vprASSERT((pf_disp->viewports[vp].viewport != NULL) && "NULL viewport in pf_disp. Check if it was ever set."); 
     1467   for ( unsigned int vp = 0; vp < pfDisp->viewports.size(); ++vp ) 
     1468   { 
     1469      vprASSERT(pfDisp->viewports[vp].viewport != NULL && 
     1470                "NULL viewport in pfDisp. Check if it was ever set."); 
    14301471 
    14311472      vprDEBUG_NEXT(vrjDBG_DRAW_MGR, debugLevel) 
    14321473         << "Viewport " << vp << vprDEBUG_FLUSH; 
    14331474      vprDEBUG_NEXT(vrjDBG_DRAW_MGR, debugLevel) 
    1434          << "      vp: " << *pf_disp->viewports[vp].viewport 
     1475         << "      vp: " << *pfDisp->viewports[vp].viewport 
    14351476         << vprDEBUG_FLUSH; 
    14361477 
    1437       for(int ch=0;ch<2;ch++) 
    1438       { 
    1439          pfChannel* cur_chan = pf_disp->viewports[vp].chans[ch]; 
    1440          unsigned chan_mask(0); 
    1441          if(cur_chan != NULL) 
     1478      for ( int ch = 0; ch < 2; ++ch ) 
     1479      { 
     1480         pfChannel* cur_chan = pfDisp->viewports[vp].chans[ch]; 
     1481         unsigned int chan_mask(0); 
     1482         if ( cur_chan != NULL ) 
     1483         { 
    14421484            chan_mask = cur_chan->getShare(); 
     1485         } 
    14431486         vprDEBUG_NEXT(vrjDBG_DRAW_MGR, debugLevel) 
    1444               << "chan " << ch << " -- " << std::hex << (void*) cur_chan 
    1445               << std::dec << "  shared: FOV:" << (chan_mask & PFCHAN_FOV) 
    1446               << " Scene:" << (chan_mask & PFCHAN_SCENE) 
    1447               << " AppFunc:" << (chan_mask & PFCHAN_APPFUNC) 
    1448               << " SwapBuff:" << (chan_mask & PFCHAN_SWAPBUFFERS) 
    1449               << " SwapBuff-HW:" << (chan_mask & PFCHAN_SWAPBUFFERS_HW) 
    1450               << std::endl << vprDEBUG_FLUSH; 
    1451       } 
    1452    } 
    1453  
    1454    vprDEBUG_CONT_END(vrjDBG_DRAW_MGR,debugLevel) << vprDEBUG_FLUSH; 
    1455 
    1456  
    1457  
     1487            << "chan " << ch << " -- " << std::hex << (void*) cur_chan 
     1488            << std::dec << "  shared: FOV:" << (chan_mask & PFCHAN_FOV) 
     1489            << " Scene:" << (chan_mask & PFCHAN_SCENE) 
     1490            << " AppFunc:" << (chan_mask & PFCHAN_APPFUNC) 
     1491            << " SwapBuff:" << (chan_mask & PFCHAN_SWAPBUFFERS) 
     1492            << " SwapBuff-HW:" << (chan_mask & PFCHAN_SWAPBUFFERS_HW) 
     1493            << std::endl << vprDEBUG_FLUSH; 
     1494      } 
     1495   } 
     1496 
     1497   vprDEBUG_CONT_END(vrjDBG_DRAW_MGR, debugLevel) << vprDEBUG_FLUSH; 
     1498
    14581499 
    14591500// Config function called in draw proc after window is set up 
     
    14821523} 
    14831524 
    1484  
    14851525/* 
    1486 void PfAppFunc(pfChannel *chan, void* chandata) 
     1526void PfAppFunc(pfChannel* chan, void* chandata) 
    14871527{ 
    14881528   vprDEBUG(vrjDBG_DRAW_MGR, vprDBG_CRITICAL_LVL) 
     
    14931533 
    14941534   pfChannel* master_chan = PfDrawManager::instance()->mMasterChan; 
    1495    if(master_chan == chan
     1535   if ( master_chan == chan
    14961536   { 
    14971537      vprDEBUG(vrjDBG_DRAW_MGR, vprDBG_CRITICAL_LVL) 
    14981538         << "I am the master of the house:\n" << vprDEBUG_FLUSH; 
    1499       if(PfDrawManager::instance()->mPfAppCalled == false)      // Haven't called it yet 
     1539      if ( PfDrawManager::instance()->mPfAppCalled == false )      // Haven't called it yet 
    15001540      { 
    15011541         vprDEBUG(vrjDBG_DRAW_MGR, vprDBG_CRITICAL_LVL)