Changeset 19938

Show
Ignore:
Timestamp:
04/10/07 09:54:25 (1 year ago)
Author:
patrick
Message:

Fixed coding standard violations. No functional changes.

Files:

Legend:

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

    r19937 r19938  
    7474 
    7575// Draw Callbacks 
    76 void PfDrawFuncStereoLeft(pfChannel *chan, void* chandata); 
    77 void PfDrawFuncStereoRight(pfChannel *chan, void* chandata); 
    78 void PfDrawFuncMonoBackbuffer(pfChannel *chan, void* chandata); 
     76void PfDrawFuncStereoLeft(pfChannel* chan, void* chandata); 
     77void PfDrawFuncStereoRight(pfChannel* chan, void* chandata); 
     78void PfDrawFuncMonoBackbuffer(pfChannel* chan, void* chandata); 
    7979//void PfDrawFuncSimulator(pfChannel* chan, void* chandata); 
    80 //void PfAppFunc(pfChannel *chan, void* chandata); 
    81  
    82  
    83 void PfPipeSwapFunc(pfPipe *p, pfPipeWindow *pw); 
     80//void PfAppFunc(pfChannel* chan, void* chandata); 
     81 
     82 
     83void PfPipeSwapFunc(pfPipe* p, pfPipeWindow* pw); 
    8484 
    8585vprSingletonImp(PfDrawManager); 
     
    8888{ 
    8989   //TODO: Add thread safety. 
    90    for ( std::vector<PfInputHandler*>::iterator itr = mPfInputHandlers.begin()
    91          itr != mPfInputHandlers.end() ; itr++
     90   typedef std::vector<PfInputHandler*>::iterator iter_type
     91   for ( iter_type itr = mPfInputHandlers.begin(); itr != mPfInputHandlers.end(); ++itr
    9292   { 
    9393      delete *itr; 
     
    117117   // pipes when creating a new display_system element is 0. It needs to be this 
    118118   // because we can not fill in the list of pipes with default values. 
    119    if(mNumPipes < 1
     119   if ( mNumPipes < 1
    120120   { 
    121121      mNumPipes = 1; 
    122122   } 
    123123 
    124    for (unsigned int i=0;i<mNumPipes;i++
     124   for ( unsigned int i = 0; i < mNumPipes; ++i
    125125   { 
    126126      std::string cur_disp_name = "-1"; 
    127127 
    128       // NOTE: ConfigElements return the default value for a property if a value is 
    129       //       not present. So if a pipe string is not specified for this pipe then 
    130       //       it gets the default value of "-1". 
     128      // NOTE: ConfigElements return the default value for a property if a 
     129      //       value is not present. So if a pipe string is not specified for 
     130      //       this pipe then it gets the default value of "-1". 
    131131      mPipeStrs.push_back(element->getProperty<std::string>("x11_pipes", i)); 
    132132 
    133       if(mPipeStrs[i] == cur_disp_name)    // Use display env 
     133      if ( mPipeStrs[i] == cur_disp_name )    // Use display env 
    134134      { 
    135135         std::string display_env; 
     
    146146         << vprDEBUG_FLUSH; 
    147147   } 
     148 
    148149   return true; 
    149150} 
     
    173174   pfFrame(); 
    174175 
    175    for (std::vector<PfInputHandler*>::iterator itr = mPfInputHandlers.begin()
    176         itr != mPfInputHandlers.end() ; itr++
     176   typedef std::vector<PfInputHandler*>::iterator iter_type
     177   for ( iter_type itr = mPfInputHandlers.begin(); itr != mPfInputHandlers.end(); ++itr
    177178   { 
    178179      (*itr)->checkEvents(); 
    179180   } 
    180181} 
    181  
    182182 
    183183// XXX: Hack for now 
     
    187187   //    for(each viewport) 
    188188   //       for(each channel) 
    189    for(unsigned int dispIndex=0;dispIndex<mDisplays.size();dispIndex++
    190    { 
    191       for(unsigned vp=0;vp<mDisplays[dispIndex].viewports.size();vp++
    192       { 
    193          for(unsigned ch=0;ch<2;ch++
     189   for ( unsigned int dispIndex = 0; dispIndex < mDisplays.size(); ++dispIndex
     190   { 
     191      for ( unsigned int vp = 0; vp < mDisplays[dispIndex].viewports.size(); ++vp
     192      { 
     193         for ( unsigned int ch = 0; ch < 2; ++ch
    194194         { 
    195             if(mDisplays[dispIndex].viewports[vp].chans[ch] != NULL) 
     195            if ( mDisplays[dispIndex].viewports[vp].chans[ch] != NULL ) 
     196            { 
    196197               mApp->appChanFunc(mDisplays[dispIndex].viewports[vp].chans[ch]); 
     198            } 
    197199         } 
    198200      } 
    199201   } 
    200202} 
    201  
    202203 
    203204/** 
     
    206207 * @post dynamic_cast<> of the app to a Pf app. 
    207208 */ 
    208 void PfDrawManager::setApp(App* _app) 
     209void PfDrawManager::setApp(App* app) 
    209210{ 
    210211   //vprASSERT(app != NULL); 
    211    mApp = dynamic_cast<PfApp*>(_app); 
    212    if(mPfHasForked) 
    213       initAppGraph();         // If pf is already started, then intialize the app scene graph 
    214  
     212   mApp = dynamic_cast<PfApp*>(app); 
     213 
     214   // If pf is already started, then intialize the app scene graph. 
     215   if ( mPfHasForked ) 
     216   { 
     217      initAppGraph(); 
     218   } 
    215219} 
    216220 
     
    226230   pfuInitUtil(); 
    227231    
    228    // XXX: This call should really be triggered by a change in draw manager or something 
     232   // XXX: This call should really be triggered by a change in draw manager or 
     233   // something. 
    229234   vprASSERT(mDisplayManager != NULL); 
    230    configDisplaySystem(mDisplayManager->getDisplaySystemElement());    // Configure all the display system stuff 
     235 
     236   // Configure all the display system stuff. 
     237   configDisplaySystem(mDisplayManager->getDisplaySystemElement()); 
    231238 
    232239   mApp->preForkInit(); 
     
    246253#else 
    247254   // If we are running in a cluster then we must run in single process mode. 
    248    if(jccl::ConfigManager::instance()->isElementTypeInPendingList("cluster_manager") || 
    249       jccl::ConfigManager::instance()->isElementTypeInActiveList("cluster_manager")
     255   if ( jccl::ConfigManager::instance()->isElementTypeInPendingList("cluster_manager") || 
     256      jccl::ConfigManager::instance()->isElementTypeInActiveList("cluster_manager")
    250257   { 
    251258      vprDEBUG_BEGIN(vrjDBG_DRAW_MGR, vprDBG_STATE_LVL) 
     
    263270#endif 
    264271 
    265 // We can not init head and wand model loaders since they are loaded in PfBasicSimInterface 
     272   // We can not init head and wand model loaders since they are loaded in 
     273   // PfBasicSimInterface. 
    266274//   initLoaders();          // Must call before pfConfig 
    267275 
     
    275283 
    276284   // Initialize the pipes that the system may need 
    277    // If we don't do this, then pf automatically give each pipe a big black channel 
     285   // If we don't do this, then pf automatically give each pipe a big black 
     286   // channel. 
    278287   initPipes(); 
    279288 
    280289   initPerformerGraph();        // Create the other scene graph nodes 
    281    if(mApp != NULL) 
     290   if ( NULL != mApp ) 
     291   { 
    282292      initAppGraph();           // App was already set, but pf was not loaded.  So load graph now 
    283  
     293   } 
    284294 
    285295   vprASSERT(mRoot != NULL && "We have a NULL root in PfDrawManager"); 
    286    vprASSERT(mRootWithSim != NULL && "We have a NULL sim root scene in PfDrawManager"); 
    287    vprASSERT(mSceneRoot != NULL && "We have a NULL root scene in PfDrawManager"); 
     296   vprASSERT(mRootWithSim != NULL && 
     297             "We have a NULL sim root scene in PfDrawManager"); 
     298   vprASSERT(mSceneRoot != NULL && 
     299             "We have a NULL root scene in PfDrawManager"); 
    288300 
    289301   //pfFrame(); 
     
    300312 * Gets a Performer pipe. 
    301313 * 
    302  * @pre pipe_num < mNumPipes 
     314 * @pre pipeNum < mNumPipes 
    303315 *       Fork must have happened. 
    304316 */ 
    305 pfPipe* PfDrawManager::getPfPipe(unsigned pipe_num) 
     317pfPipe* PfDrawManager::getPfPipe(unsigned int pipeNum) 
    306318{ 
    307319   vprASSERT((mPfHasForked) && "Tried to get pipe before forking happened"); 
    308    vprASSERT((pipe_num < mNumPipes) && "Tried to request out of bounds pipe"); 
    309    vprASSERT((pipe_num < mPipes.size()) && "Tried to get out of range pipe"); 
    310    vprASSERT((NULL != mPipes[pipe_num]) && "Have NULL pipe"); 
     320   vprASSERT((pipeNum < mNumPipes) && "Tried to request out of bounds pipe"); 
     321   vprASSERT((pipeNum < mPipes.size()) && "Tried to get out of range pipe"); 
     322   vprASSERT((NULL != mPipes[pipeNum]) && "Have NULL pipe"); 
    311323 
    312324   // Print an error message if an invalid pipe was requested.  This will 
    313325   // probably only happen when a configuration is broken. 
    314    if ( pipe_num >= mNumPipes || pipe_num >= mPipes.size() || 
    315         NULL == mPipes[pipe_num] ) 
     326   if ( pipeNum >= mNumPipes || pipeNum >= mPipes.size() || 
     327        NULL == mPipes[pipeNum] ) 
    316328   { 
    317329      vprDEBUG(vprDBG_ERROR, vprDBG_CRITICAL_LVL) 
    318330         << clrOutNORM(clrRED, "ERROR") 
    319          << ": Invalid pipe number (" << pipe_num << ") requested.  " 
     331         << ": Invalid pipe number (" << pipeNum << ") requested.  " 
    320332         << "Check display system configuration.\n" << vprDEBUG_FLUSH; 
    321333      return NULL; 
     
    324336   { 
    325337      // Return the actual pipe 
    326       return mPipes[pipe_num]; 
     338      return mPipes[pipeNum]; 
    327339   } 
    328340} 
     
    335347   mPipes.resize(mNumPipes, NULL);     // Resize the vector 
    336348 
    337    for(unsigned pipe_num=0; pipe_num<mNumPipes; pipe_num++
     349   for ( unsigned int pipe_num = 0; pipe_num < mNumPipes; ++pipe_num
    338350   { 
    339351      vprDEBUG(vrjDBG_DRAW_MGR, vprDBG_CONFIG_LVL) 
     
    349361 
    350362      pfPipeWindow* pw = allocatePipeWin(pipe_num);   // new pfPipeWindow(mPipes[pipe_num]); 
    351       pw->setOriginSize(0,0,1,1); 
     363      pw->setOriginSize(0, 0, 1, 1); 
    352364 
    353365      // XXX: Set the swap func 
    354       mPipes[pipe_num]->setSwapFunc( PfPipeSwapFunc );      // Set to the given swap func 
     366      mPipes[pipe_num]->setSwapFunc(PfPipeSwapFunc);  // Set to the given swap func 
    355367   } 
    356368} 
     
    365377{ 
    366378   vprASSERT(disp.get() != NULL);    // Can't add a null display 
    367    vprASSERT((true == mPfHasForked) && "Trying to add display when performer has not been initialized"); 
     379   vprASSERT(mPfHasForked && 
     380             "Trying to add display when performer has not been initialized"); 
    368381 
    369382   //  For the display 
     
    408421   // Setup window border 
    409422   if (disp->shouldDrawBorder()) 
     423   { 
    410424      pf_disp.pWin->setName(disp->getName().c_str()); // Give the window a name 
     425   } 
    411426   else 
    412       pf_disp.pWin->setMode(PFWIN_NOBORDER, 1);          // Get rid of that border 
     427   { 
     428      pf_disp.pWin->setMode(PFWIN_NOBORDER, 1);       // Get rid of that border 
     429   } 
    413430 
    414431   jccl::ConfigElementPtr fb_elt = disp->getGlFrameBufferConfig(); 
     
    484501   //   - Setup master chans 
    485502   Viewport* viewport = NULL; 
    486    unsigned num_vps = disp->getNumViewports(); 
     503   const unsigned int num_vps = disp->getNumViewports(); 
    487504 
    488505   vprDEBUG(vrjDBG_DRAW_MGR, vprDBG_CONFIG_LVL) 
    489506      << "   Num viewports: " << num_vps << std::endl << vprDEBUG_FLUSH; 
    490507 
    491    for(unsigned vp_num=0; vp_num < num_vps; vp_num++
     508   for ( unsigned int vp_num = 0; vp_num < num_vps; ++vp_num
    492509   { 
    493510      viewport = disp->getViewport(vp_num); 
    494511 
    495       if(viewport->isActive())      // is viewport active 
     512      if ( viewport->isActive() )      // is viewport active 
    496513      { 
    497514         //Viewport::View view = viewport->getView(); 
    498          pfViewport pf_viewport;                         // The viewport to build up 
     515         pfViewport pf_viewport;                  // The viewport to build up 
    499516         pf_viewport.viewport = viewport; 
    500517         float vp_ox, vp_oy, vp_sx, vp_sy; 
     
    504521         viewport->getOriginAndSize(vp_ox, vp_oy, vp_sx, vp_sy); 
    505522         pf_viewport.chans[pfViewport::PRIMARY] = new pfChannel(pipe); 
    506          pf_viewport.chans[pfViewport::PRIMARY]->setViewport(vp_ox, vp_ox+vp_sx, vp_oy, vp_oy+vp_sy); 
     523         pf_viewport.chans[pfViewport::PRIMARY]->setViewport(vp_ox, 
     524                                                             vp_ox + vp_sx, 
     525                                                             vp_oy, 
     526                                                             vp_oy + vp_sy); 
    507527         pf_disp.pWin->addChan(pf_viewport.chans[pfViewport::PRIMARY]); 
    508528 
    509529         // Secondary channel - (Right in stereo) 
    510          if(disp->isStereoRequested()
     530         if ( disp->isStereoRequested()
    511531         { 
    512532            pf_viewport.chans[pfViewport::SECONDARY] = new pfChannel(pipe); 
    513             pf_viewport.chans[pfViewport::SECONDARY]->setViewport(vp_ox, vp_ox+vp_sx, vp_oy, vp_oy+vp_sy); 
     533            pf_viewport.chans[pfViewport::SECONDARY]->setViewport(vp_ox, 
     534                                                                  vp_ox + vp_sx, 
     535                                                                  vp_oy, 
     536                                                                  vp_oy + vp_sy); 
    514537            pf_disp.pWin->addChan(pf_viewport.chans[pfViewport::SECONDARY]); 
    515538         } 
    516539 
    517540         // Set draw function 
    518          if(disp->isStereoRequested()
     541         if ( disp->isStereoRequested()
    519542         { 
    520             pf_viewport.chans[pfViewport::PRIMARY]->setTravFunc(PFTRAV_DRAW, PfDrawFuncStereoLeft); 
    521             pf_viewport.chans[pfViewport::SECONDARY]->setTravFunc(PFTRAV_DRAW, PfDrawFuncStereoRight); 
     543            pf_viewport.chans[pfViewport::PRIMARY]->setTravFunc(PFTRAV_DRAW, 
     544                                                                PfDrawFuncStereoLeft); 
     545            pf_viewport.chans[pfViewport::SECONDARY]->setTravFunc(PFTRAV_DRAW, 
     546                                                                  PfDrawFuncStereoRight); 
    522547         } 
    523548         else 
    524549         { 
    525             pf_viewport.chans[pfViewport::PRIMARY]->setTravFunc(PFTRAV_DRAW, PfDrawFuncMonoBackbuffer); 
     550            pf_viewport.chans[pfViewport::PRIMARY]->setTravFunc(PFTRAV_DRAW, 
     551                                                                PfDrawFuncMonoBackbuffer); 
    526552         } 
    527553 
    528554         // if surface ==> Setup surface channels 
    529          if (viewport->isSurface()
     555         if ( viewport->isSurface()
    530556         { 
    531557            vprASSERT(pf_viewport.chans[pfViewport::PRIMARY] != NULL); 
    532558 
    533559            // Primary 
    534             if(NULL == mSurfMasterChan)      // If NULL, then add us as the new one 
     560            if ( NULL == mSurfMasterChan )      // If NULL, then add us as the new one 
    535561            { 
    536562               mSurfMasterChan = pf_viewport.chans[pfViewport::PRIMARY]; 
     
    546572 
    547573            // Secondary 
    548             if(NULL != pf_viewport.chans[pfViewport::SECONDARY]
     574            if ( NULL != pf_viewport.chans[pfViewport::SECONDARY]
    549575            { 
    550576               mSurfChannels.push_back(pf_viewport.chans[pfViewport::SECONDARY]); 
    551577               mSurfMasterChan->attach(pf_viewport.chans[pfViewport::SECONDARY]); 
    552578            } 
    553  
    554579         } 
    555580         // if sim ==> setup sim channels 
    556          else if(viewport->isSimulator()
     581         else if ( viewport->isSimulator()
    557582         { 
    558583            // -- Finish Simulator setup 
     
    566591 
    567592            // Create the simulator stuff 
    568             vprASSERT(1 == vp_element->getNum("simulator_plugin") && "You must supply a simulator plugin."); 
     593            vprASSERT(1 == vp_element->getNum("simulator_plugin") && 
     594                      "You must supply a simulator plugin."); 
    569595 
    570596            jccl::ConfigElementPtr sim_element = 
     
    590616 
    591617            // Primary 
    592             if(NULL == mSimMasterChan)        // If NULL, then make us the master 
     618            if ( NULL == mSimMasterChan )        // If NULL, then make us the master 
    593619            { 
    594620               mSimMasterChan = pf_viewport.chans[pfViewport::PRIMARY]; 
     
    604630 
    605631            // Secondary 
    606             if(NULL != pf_viewport.chans[pfViewport::SECONDARY]
     632            if ( NULL != pf_viewport.chans[pfViewport::SECONDARY]
    607633            { 
    608634               mSimChannels.push_back(pf_viewport.chans[pfViewport::SECONDARY]); 
     
    613639         // Add viewport to the display list 
    614640         pf_disp.viewports.push_back(pf_viewport); 
    615  
    616641      }  // is viewport active 
    617642   }     // for each viewport 
     
    629654   // Performer says that if you trigger a window from the applciation proccess 
    630655   // you must wait for the window to open during the draw process. 
    631    while( !pfIsPWinOpen( pf_disp.pWin ) ) 
     656   while ( ! pfIsPWinOpen(pf_disp.pWin) ) 
    632657   { 
    633658      pfFrame(); 
    634       vpr::System::usleep( 500 );  
    635    } 
    636  
    637    PfInputHandler* new_input_handler = new PfInputHandler(pf_disp.pWin, disp->getName()); 
     659      vpr::System::usleep(500);  
     660   } 
     661 
     662   PfInputHandler* new_input_handler = 
     663      new PfInputHandler(pf_disp.pWin, disp->getName()); 
    638664    
    639665   // Configure the Performer window to accept events. 
     
    641667   new_input_handler->config(display_elt, disp); 
    642668 
    643     
    644669   mPfInputHandlers.push_back(new_input_handler); 
    645670 
    646    if(pf_disp.disp->shouldHideMouse()
     671   if ( pf_disp.disp->shouldHideMouse()
    647672   { 
    648673      pfuLoadPWinCursor(pf_disp.pWin, PFU_CURSOR_OFF); 
     
    680705*/ 
    681706 
    682  
    683  
    684  
    685707/** 
    686708 * Callback when display is removed to display manager. 
     
    704726   } 
    705727#else 
    706    std::vector<pfDisplay>::iterator disp_i = std::find_if(mDisplays.begin(), mDisplays.end(), 
    707                          std::compose1( std::bind2nd( std::equal_to<DisplayPtr>(),disp), 
    708                                         pfDisplay_disp()) ); 
     728   std::vector<pfDisplay>::iterator disp_i = 
     729      std::find_if(mDisplays.begin(), mDisplays.end(), 
     730                   std::compose1(std::bind2nd(std::equal_to<DisplayPtr>(), disp), 
     731                                 pfDisplay_disp())); 
    709732#endif 
    710733 
    711  
    712    if(mDisplays.end() == disp_i) 
     734   if ( mDisplays.end() == disp_i ) 
    713735   { 
    714736      vprDEBUG(vrjDBG_DRAW_MGR, vprDBG_CRITICAL_LVL) 
     
    718740   } 
    719741 
    720  
    721742   // Release the pfDisplay 
    722743   releaseDisplay(*disp_i); 
     
    729750{ 
    730751   // Release all viewports 
    731    for(std::vector<pfViewport>::iterator i=disp.viewports.begin(); i != disp.viewports.end(); i++) 
     752   typedef std::vector<pfViewport>::iterator iter_type; 
     753   for ( iter_type i = disp.viewports.begin(); i != disp.viewports.end(); ++i ) 
    732754   { 
    733755      releaseViewport(disp, *i); 
     
    738760} 
    739761 
    740  
    741762void PfDrawManager::releaseViewport(pfDisplay& disp, pfViewport& vp) 
    742763{ 
     
    744765 
    745766   // Release the channel stuff 
    746    for(int i=0;i<2;i++
     767   for ( int i = 0; i < 2; ++i
    747768   { 
    748769      pfChannel* chan = vp.chans[i]; 
    749770 
    750771      // if we have a channel to delete 
    751       if(chan != NULL
    752       { 
    753          if(vp.viewport->isSurface())         // SURFACE display 
     772      if ( chan != NULL
     773      { 
     774         if ( vp.viewport->isSurface() )         // SURFACE display 
    754775         { 
    755776            // Remove the channel from the list of channels 
    756             chan_i = std::find(mSurfChannels.begin(), mSurfChannels.end(), chan); 
    757             if(chan_i == mSurfChannels.end()) 
     777            chan_i = std::find(mSurfChannels.begin(), mSurfChannels.end(), 
     778                               chan); 
     779 
     780            if ( chan_i == mSurfChannels.end() ) 
    758781            { 
    759782               vprASSERT(false && "Trying to remove a non-existant channel"); 
     
    764787 
    765788            // Check if we were the master 
    766             if(chan == mSurfMasterChan
     789            if ( chan == mSurfMasterChan
    767790            { 
    768                mSurfMasterChan = NULL;                      // Get new master channel 
    769                if(mSurfChannels.size() > 0) 
     791               mSurfMasterChan = NULL;              // Get new master channel 
     792               if ( mSurfChannels.size() > 0 ) 
     793               { 
    770794                  mSurfMasterChan = mSurfChannels[0]; 
     795               } 
    771796            } 
    772797 
    773             if(mSurfMasterChan != NULL)                  // Dettach from the channel 
     798            if ( mSurfMasterChan != NULL )          // Dettach from the channel 
     799            { 
    774800               chan->detach(mSurfMasterChan); 
     801            } 
    775802         } 
    776          else if(vp.viewport->isSimulator())    // SIMULATOR display 
     803         else if ( vp.viewport->isSimulator() )    // SIMULATOR display 
    777804         { 
    778805            // Remove the channel from the list of channels 
    779806            chan_i = std::find(mSimChannels.begin(), mSimChannels.end(), chan); 
    780             if(chan_i == mSimChannels.end()
     807            if ( chan_i == mSimChannels.end()
    781808            { 
    782809               vprASSERT(false && "Trying to remove a non-existant channel"); 
     
    787814 
    788815            // Check if we were the master 
    789             if(chan == mSimMasterChan
     816            if ( chan == mSimMasterChan
    790817            { 
    791                mSimMasterChan = NULL;                      // Get new master channel 
    792                if(mSimChannels.size() > 0) 
     818               mSimMasterChan = NULL;             // Get new master channel 
     819               if ( mSimChannels.size() > 0 ) 
     820               { 
    793821                  mSimMasterChan = mSimChannels[0]; 
     822               } 
    794823            } 
    795824 
    796             if(mSimMasterChan != NULL)                  // Dettach from the channel 
     825            if ( mSimMasterChan != NULL )         // Dettach from the channel 
     826            { 
    797827               chan->detach(mSimMasterChan); 
     828            } 
    798829         } 
    799830 
    800831         chan->setScene(NULL); 
    801832         disp.pWin->removeChan(chan);     // Remove channel from pwin 
    802          pfDelete( chan);                     // Delete the channel 
    803       } 
    804    } 
    805 
    806  
    807  
     833         pfDelete(chan);                  // Delete the channel 
     834      } 
     835   } 
     836
    808837 
    809838// Get a pipe window to use 
    810 // This either allocates a new pipe window or grabs an unused one that was previously released 
    811 pfPipeWindow* PfDrawManager::allocatePipeWin(unsigned pipeNum) 
     839// This either allocates a new pipe window or grabs an unused one that was 
     840// previously released 
     841pfPipeWindow* PfDrawManager::allocatePipeWin(const unsigned int pipeNum) 
    812842{ 
    813843   pfPipeWindow* ret_val; 
     
    819849   } 
    820850 
    821    if(mPipeWindows[pipeNum].size() > 0)   // Is one available 
     851   if ( mPipeWindows[pipeNum].size() > 0 )   // Is one available 
    822852   { 
    823853      ret_val = mPipeWindows[pipeNum].back(); 
     
    826856   else 
    827857   { 
    828       ret_val = new pfPipeWindow(getPfPipe(pipeNum));         // Allocate a new one 
     858      ret_val = new pfPipeWindow(getPfPipe(pipeNum));    // Allocate a new one 
    829859   } 
    830860 
     
    835865 
    836866// Just store the old pipe window in the list 
    837 void PfDrawManager::releasePipeWin(pfPipeWindow* pipeWin, unsigned pipeNum) 
     867void PfDrawManager::releasePipeWin(pfPipeWindow* pipeWin, 
     868                                   const unsigned int pipeNum) 
    838869{ 
    839870   mPipeWindows[pipeNum].push_back(pipeWin); 
    840871} 
    841  
    842  
    843872 
    844873// Initialize the parameters of the master channel 
     
    859888   // Set the Channel attribs based on cur settings 
    860889   // 
    861    unsigned cur_share = masterChan->getShare();          // Get current setting, and OR the new stuff on 
    862    unsigned turn_on = ( PFCHAN_NEARFAR | PFCHAN_EARTHSKY | 
    863                         PFCHAN_STRESS | PFCHAN_LOD | PFCHAN_SWAPBUFFERS | 
    864                         PFCHAN_APPFUNC | PFCHAN_SCENE | PFCHAN_CULLFUNC | 
    865                         PFCHAN_STATS_DRAWMODE); 
    866    unsigned turn_off = (   PFCHAN_FOV | 
    867                            PFCHAN_VIEW | 
    868                            PFCHAN_VIEW_OFFSETS | 
    869                            PFCHAN_DRAWFUNC ); 
    870  
    871    masterChan->setShare((cur_share | turn_on) &(~turn_off)); 
     890   const unsigned int cur_share = masterChan->getShare();  // Get current setting, and OR the new stuff on 
     891   const unsigned int turn_on = PFCHAN_NEARFAR | PFCHAN_EARTHSKY | 
     892                                PFCHAN_STRESS | PFCHAN_LOD | 
     893                                PFCHAN_SWAPBUFFERS | PFCHAN_APPFUNC | 
     894                                PFCHAN_SCENE | PFCHAN_CULLFUNC | 
     895                                PFCHAN_STATS_DRAWMODE; 
     896   const unsigned int turn_off = PFCHAN_FOV | 
     897                                 PFCHAN_VIEW | 
     898                                 PFCHAN_VIEW_OFFSETS | 
     899                                 PFCHAN_DRAWFUNC; 
     900 
     901   masterChan->setShare((cur_share | turn_on) & ~turn_off); 
    872902 
    873903   //masterChan->setTravFunc(PFTRAV_APP, PfAppFunc); 
     
    876906   //                     PFCHAN_APPFUNC | PFCHAN_CULLFUNC ); 
    877907} 
    878  
    879908 
    880909/** Returns the needed mono frame buffer config. */ 
     
    11841213   mRootWithSim = new pfScene; 
    11851214 
    1186    mSceneGroup = new pfGroup;                // (Placeholder until app loads theirs) 
     1215   mSceneGroup = new pfGroup;           // (Placeholder until app loads theirs) 
    11871216   mRoot->addChild(mSceneGroup);        // Create the base scene without sim 
    1188    mRootWithSim->addChild(mSceneGroup);      // Create base scene with sim 
     1217   mRootWithSim->addChild(mSceneGroup); // Create base scene with sim 
    11891218} 
    11901219 
     
    11961225{ 
    11971226   mApp->initScene(); 
    1198    if(mSceneRoot != NULL) 
     1227   if ( NULL != mSceneRoot ) 
     1228   { 
    11991229      mSceneGroup->removeChild(mSceneRoot); 
     1230   } 
    12001231 
    12011232   mSceneRoot = mApp->getScene(); 
     
    12251256   //   for(each viewport) 
    12261257   //       update Performer specific stuff. 
    1227    for (unsigned disp_id=0;disp_id<mDisplays.size();disp_id++)    // each display 
     1258   for ( unsigned int disp_id = 0; disp_id < mDisplays.size(); ++disp_id )    // each display 
    12281259   { 
    12291260      pfDisplay* cur_disp = &(mDisplays[disp_id]); 
    12301261 
    12311262      vprASSERT(cur_disp->disp != NULL); 
    1232       for(unsigned vp=0;vp<cur_disp->viewports.size();vp++)       // each viewport 
     1263      for ( unsigned int vp = 0; vp < cur_disp->viewports.size(); ++vp )      // each viewport 
    12331264      { 
    12341265         pfViewport* pf_vp = &(cur_disp->viewports[vp]); 
     
    12451276         // --- All viewports --- // 
    12461277         //surf_vp = dynamic_cast<SurfaceViewport*>(pf_vp->viewport); 
    1247          //vprASSERT(surf_vp != NULL && "Could not cast supposedly surface display to SurfaceDisplay."); 
     1278         //vprASSERT(surf_vp != NULL && 
     1279         //          "Could not cast supposedly surface display to SurfaceDisplay."); 
    12481280         view = cur_vp->getView(); 
    12491281 
    1250          if(Viewport::LEFT_EYE == view
     1282         if ( Viewport::LEFT_EYE == view
    12511283         { 
    1252             updatePfProjection(pf_vp->chans[pfViewport::PRIMARY], cur_vp->getLeftProj()); 
     1284            updatePfProjection(pf_vp->chans[pfViewport::PRIMARY], 
     1285                               cur_vp->getLeftProj()); 
    12531286         } 
    1254          else if(Viewport::RIGHT_EYE == view
     1287         else if ( Viewport::RIGHT_EYE == view
    12551288         { 
    1256             updatePfProjection(pf_vp->chans[pfViewport::PRIMARY], cur_vp->getRightProj()); 
     1289            updatePfProjection(pf_vp->chans[pfViewport::PRIMARY], 
     1290                               cur_vp->getRightProj()); 
    12571291         } 
    1258          else if(Viewport::STEREO == view
     1292         else if ( Viewport::STEREO == view
    12591293         { 
    1260             updatePfProjection(pf_vp->chans[pfViewport::PRIMARY], cur_vp->getLeftProj()); 
    1261             updatePfProjection(pf_vp->chans[pfViewport::SECONDARY], cur_vp->getRightProj()); 
     1294            updatePfProjection(pf_vp->chans[pfViewport::PRIMARY], 
     1295                               cur_vp->getLeftProj()); 
     1296            updatePfProjection(pf_vp->chans[pfViewport::SECONDARY], 
     1297                               cur_vp->getRightProj()); 
    12621298         } 
    12631299         else 
     
    12671303 
    12681304         // Sim viewport 
    1269          if(cur_vp->isSimulator()
     1305         if ( cur_vp->isSimulator()
    12701306         { 
    12711307            SimViewport*      sim_vp(NULL); 
     
    12731309 
    12741310            sim_vp = dynamic_cast<SimViewport*>(pf_vp->viewport); 
    1275             vprASSERT(sim_vp != NULL && "Could not cast supposed simulator display to SimDisplay."); 
     1311            vprASSERT(sim_vp != NULL && 
     1312                      "Could not cast supposed simulator display to SimDisplay."); 
    12761313 
    12771314            draw_sim_i = 
     
    12841321            draw_sim_i->updateSimulatorSceneGraph(); 
    12851322         } 
    1286  
    12871323      } 
    12881324   } 
     
    13611397{ 
    13621398   // Search surface displays 
    1363    for(unsigned int i=0;i<mSurfDisps.size();i++
     1399   for ( unsigned int i = 0; i < mSurfDisps.size(); ++i
    13641400   { 
    13651401      pfChannel* primary_chan = mSurfDisps[i].chans[pfDisp::PRIMARY]; 
    13661402      pfChannel* secondary_chan = mSurfDisps[i].chans[pfDisp::SECONDARY]; 
    1367       if((chan == primary_chan) || (chan == secondary_chan)) 
    1368          return &(mSurfDisps[i]); 
     1403      if ( chan == primary_chan || chan == secondary_chan ) 
     1404      { 
     1405         return &mSurfDisps[i]; 
     1406      } 
    13691407   } 
    13701408 
    13711409   // Search simulator displays 
    1372    for(unsigned int i=0;i<mSimDisps.size();i++
     1410   for ( unsigned int i = 0; i < mSimDisps.size(); ++i
    13731411   { 
    13741412      pfChannel* primary_chan = mSimDisps[i].chans[pfDisp::PRIMARY]; 
    13751413      pfChannel* secondary_chan = mSimDisps[i].chans[pfDisp::SECONDARY]; 
    1376       if((chan == primary_chan) || (chan == secondary_chan)) 
    1377          return &(mSimDisps[i]); 
     1414      if ( chan == primary_chan || chan == secondary_chan ) 
     1415      { 
     1416         return &mSimDisps[i]; 
     1417      } 
    13781418   } 
    13791419 
     
    13821422*/ 
    13831423 
    1384 void PfDrawManager::debugDump(int debugLevel) 
     1424void PfDrawManager::debugDump(const int debugLevel) 
    13851425{ 
    13861426   vprDEBUG_BEGIN(vrjDBG_DRAW_MGR, debugLevel) 
     
    13901430      << vprDEBUG_FLUSH; 
    13911431   vprDEBUG_NEXT(vrjDBG_DRAW_MGR, debugLevel) 
    1392       << "App: 0x" << std::hex << (void*)mApp << std::dec << std::endl 
     1432      << "App: 0x" << std::hex << (void*) mApp << std::dec << std::endl 
    13931433      << vprDEBUG_FLUSH; 
    13941434   vprDEBUG_NEXT(vrjDBG_DRAW_MGR, debugLevel) 
    1395       << "Scene: 0x" << std::hex << (void*)mRoot << std::dec << std::endl 
     1435      << "Scene: 0x" << std::hex << (void*) mRoot << std::dec << std::endl 
    13961436      << vprDEBUG_FLUSH; 
    13971437   vprDEBUG_NEXT(vrjDBG_DRAW_MGR, debugLevel) 
    1398       << "Sim scene: 0x" << std::hex << (void*)mRootWithSim << std::dec 
     1438      << "Sim scene: 0x" << std::hex << (void*) mRootWithSim << std::dec 
    13991439      << std::endl << vprDEBUG_FLUSH; 
    14001440   vprDEBUG_NEXT(vrjDBG_DRAW_MGR, debugLevel) 
     
    14021442      << vprDEBUG_FLUSH; 
    14031443 
    1404    for (std::vector<pfDisplay>::iterator i = mDisplays.begin(); i != mDisplays.end(); i++) 
     1444   typedef std::vector<pfDisplay>::iterator iter_type; 
     1445   for ( iter_type i = mDisplays.begin(); i != mDisplays.end(); ++i ) 
    14051446   { 
    14061447      debugDumpPfDisp(&(*i),debugLevel); 
     
    14111452} 
    14121453 
    1413  
    1414 void PfDrawManager::debugDumpPfDisp(pfDisplay* pf_disp, int debugLevel) 
     1454void PfDrawManager::debugDumpPfDisp(pfDisplay* pfDisp, const int debugLevel) 
    14151455{ 
    14161456   vprDEBUG_BEGIN(vrjDBG_DRAW_MGR, debugLevel) 
    1417       << "Display: 0x" << std::hex << (void*) pf_disp->disp.get() << std::dec 
     1457      << "Display: 0x" << std::hex << (void*) pfDisp->disp.get() << std::dec 
    14181458      << std::endl << vprDEBUG_FLUSH; 
    1419    vprDEBUG_NEXT(vrjDBG_DRAW_MGR,debugLevel) 
    1420       << "pWin: 0x" << std::hex << (void*) pf_disp->pWin << std::dec 
     1459   vprDEBUG_NEXT(vrjDBG_DRAW_MGR, debugLevel) 
     1460      << "pWin: 0x" << std::hex << (void*) pfDisp->pWin << std::dec 
    14211461      << std::endl << vprDEBUG_FLUSH; 
    1422    vprDEBUG_NEXT(vrjDBG_DRAW_MGR,debugLevel) 
    1423       << "visual ID: 0x" << std::hex << pf_disp->pWin->getFBConfigId() 
     1462   vprDEBUG_NEXT(vrjDBG_DRAW_MGR, debugLevel) 
     1463      << "visual ID: 0x" << std::hex << pfDisp->pWin->getFBConfigId() 
    14241464      << std::dec << std::endl << vprDEBUG_FLUSH; 
    14251465 
    1426    for(unsigned vp=0; vp<pf_disp->viewports.size(); ++vp) 
    1427    { 
    1428       vprASSERT((pf_disp->viewports[vp].viewport != NULL) && "NULL viewport in pf_disp. Check if it was ever set."); 
     1466   for ( unsigned int vp = 0; vp < pfDisp->viewports.size(); ++vp ) 
     1467   { 
     1468      vprASSERT(pfDisp->viewports[vp].viewport != NULL && 
     1469                "NULL viewport in pfDisp. Check if it was ever set."); 
    14291470 
    14301471      vprDEBUG_NEXT(vrjDBG_DRAW_MGR, debugLevel) 
    14311472         << "Viewport " << vp << vprDEBUG_FLUSH; 
    14321473      vprDEBUG_NEXT(vrjDBG_DRAW_MGR, debugLevel) 
    1433          << "      vp: " << *pf_disp->viewports[vp].viewport 
     1474         << "      vp: " << *pfDisp->viewports[vp].viewport 
    14341475         << vprDEBUG_FLUSH; 
    14351476 
    1436       for(int ch=0;ch<2;ch++) 
    1437       { 
    1438          pfChannel* cur_chan = pf_disp->viewports[vp].chans[ch]; 
    1439          unsigned chan_mask(0); 
    1440          if(cur_chan != NULL) 
     1477      for ( int ch = 0; ch < 2; ++ch ) 
     1478      { 
     1479         pfChannel* cur_chan = pfDisp->viewports[vp].chans[ch]; 
     1480         unsigned int chan_mask(0); 
     1481         if ( cur_chan != NULL ) 
     1482         { 
    14411483            chan_mask = cur_chan->getShare(); 
     1484         } 
    14421485         vprDEBUG_NEXT(vrjDBG_DRAW_MGR, debugLevel) 
    1443               << "chan " << ch << " -- " << std::hex << (void*) cur_chan 
    1444               << std::dec << "  shared: FOV:" << (chan_mask & PFCHAN_FOV) 
    1445               << " Scene:" << (chan_mask & PFCHAN_SCENE) 
    1446               << " AppFunc:" << (chan_mask & PFCHAN_APPFUNC) 
    1447               << " SwapBuff:" << (chan_mask & PFCHAN_SWAPBUFFERS) 
    1448               << " SwapBuff-HW:" << (chan_mask & PFCHAN_SWAPBUFFERS_HW) 
    1449               << std::endl << vprDEBUG_FLUSH; 
    1450       } 
    1451    } 
    1452  
    1453    vprDEBUG_CONT_END(vrjDBG_DRAW_MGR,debugLevel) << vprDEBUG_FLUSH; 
    1454 
    1455  
    1456  
     1486            << "chan " << ch << " -- " << std::hex << (void*) cur_chan 
     1487            << std::dec << "  shared: FOV:" << (chan_mask & PFCHAN_FOV) 
     1488            << " Scene:" << (chan_mask & PFCHAN_SCENE) 
     1489            << " AppFunc:" << (chan_mask & PFCHAN_APPFUNC) 
     1490            << " SwapBuff:" << (chan_mask & PFCHAN_SWAPBUFFERS) 
     1491            << " SwapBuff-HW:" << (chan_mask & PFCHAN_SWAPBUFFERS_HW) 
     1492            << std::endl << vprDEBUG_FLUSH; 
     1493      } 
     1494   } 
     1495 
     1496   vprDEBUG_CONT_END(vrjDBG_DRAW_MGR, debugLevel) << vprDEBUG_FLUSH; 
     1497
    14571498 
    14581499// Config function called in draw proc after window is set up 
     
    14811522} 
    14821523 
    1483  
    14841524/* 
    1485 void PfAppFunc(pfChannel *chan, void* chandata) 
     1525void PfAppFunc(pfChannel* chan, void* chandata) 
    14861526{ 
    14871527   vprDEBUG(vrjDBG_DRAW_MGR, vprDBG_CRITICAL_LVL) 
     
    14921532 
    14931533   pfChannel* master_chan = PfDrawManager::instance()->mMasterChan; 
    1494    if(master_chan == chan
     1534   if ( master_chan == chan
    14951535   { 
    14961536      vprDEBUG(vrjDBG_DRAW_MGR, vprDBG_CRITICAL_LVL) 
    14971537         << "I am the master of the house:\n" << vprDEBUG_FLUSH; 
    1498       if(PfDrawManager::instance()->mPfAppCalled == false)      // Haven't called it yet 
     1538      if ( PfDrawManager::instance()->mPfAppCalled == false )      // Haven't called it yet 
    14991539      { 
    15001540         vprDEBUG(vrjDBG_DRAW_MGR, vprDBG_CRITICAL_LVL) 
     
    15071547   else 
    15081548   { 
    1509       vprDEBUG(vrjDBG_DRAW_MGR, vprDBG_CRITICAL_LVL) << "I am not master. I can't do anything.\n" << vprDEBUG_FLUSH; 
     1549  &n