Changeset 19839

Show
Ignore:
Timestamp:
02/22/07 21:02:32 (2 years ago)
Author:
patrick
Message:

vrj::DrawObjectFunctor? has a contextInit() method, but it was not being used.
This change adds vrj::GlSimInterface::contextInit() so that the
vrj::GlBasicSimulator? override can perform context-specific initialization of
its draw object functors. Bumped version to 2.1.18.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • juggler/trunk/modules/vrjuggler/ChangeLog

    r19833 r19839  
    11DATE        AUTHOR      CHANGE 
    22----------- ----------- ------------------------------------------------------- 
     3Feb-22-2007 patrick     Added vrj::GlSimInterface::contextInit() so that the 
     4                        contextInit() method in vrj::GlDrawObjectFunctor can 
     5                        be invoked. 
     6                        NEW VERSION: 2.1.18 
    37Feb-21-2007 patrick     Updated for new keys in Gadgeteer 1.1.24. 
    48Jan-30-2007 patrick     Eliminated the need to set VJ_BASE_DIR on Windwos to 
  • juggler/trunk/modules/vrjuggler/VERSION

    r19790 r19839  
    1 2.1.17-0 @01/30/2007 22:30:00 UTC@ 
     12.1.18-0 @02/23/2007 03:05:00 UTC@ 
    222.1.16-0 @12/18/2006 17:45:00 UTC@ 
    332.1.15-0 @11/14/2006 23:05:00 UTC@ 
  • juggler/trunk/modules/vrjuggler/vrj/Draw/OGL/GlBasicSimulator.cpp

    r19729 r19839  
    119119} 
    120120 
     121void GlBasicSimulator::contextInit() 
     122{ 
     123   initSimulator(); 
     124} 
     125 
    121126/** 
    122127 * Draws this sim device using the given information about the Window it 
     
    127132   drawSimulator(scaleFactor); 
    128133} 
    129  
    130134 
    131135/** 
     
    319323      }  // for viewports 
    320324   }  // for disps 
     325} 
     326 
     327void GlBasicSimulator::initSimulator() 
     328{ 
     329   mDrawHeadFunctor->contextInit(); 
     330   mDrawWandFunctor->contextInit(); 
    321331} 
    322332 
  • juggler/trunk/modules/vrjuggler/vrj/Draw/OGL/GlBasicSimulator.h

    r19729 r19839  
    7676 
    7777   /** 
     78    * Tells the simulator draw functors to perform context-specific 
     79    * negotiation. 
     80    * 
     81    * @since 2.1.18 
     82    */ 
     83   virtual void contextInit(); 
     84 
     85   /** 
    7886    * Draws this sim device using the given information about the Window it 
    7987    * will be drawing into. 
     
    136144   void drawProjections(bool drawFrustum, gmtl::Vec3f surfColor, 
    137145                        const float scaleFactor); 
     146 
     147   /** 
     148    * Tells the simulator draw functors to perform context-specific 
     149    * negotiation. 
     150    */ 
     151   void initSimulator(); 
    138152 
    139153   /** 
  • juggler/trunk/modules/vrjuggler/vrj/Draw/OGL/GlDrawHeadFunctors.cpp

    r19729 r19839  
    3737 
    3838GlDrawEllipsoidHeadFunctor::GlDrawEllipsoidHeadFunctor() 
    39    : mQuadObj(gluNewQuadric()
     39   : mQuadObj(NULL
    4040{ 
    4141} 
     
    4343GlDrawEllipsoidHeadFunctor::~GlDrawEllipsoidHeadFunctor() 
    4444{ 
    45    gluDeleteQuadric(mQuadObj); 
     45   if ( NULL != mQuadObj ) 
     46   { 
     47      gluDeleteQuadric(mQuadObj); 
     48   } 
     49
     50 
     51void GlDrawEllipsoidHeadFunctor::contextInit() 
     52
     53   if ( NULL == mQuadObj ) 
     54   { 
     55      mQuadObj = gluNewQuadric(); 
     56   } 
    4657} 
    4758 
  • juggler/trunk/modules/vrjuggler/vrj/Draw/OGL/GlDrawHeadFunctors.h

    r19729 r19839  
    5656 
    5757   /** Called to initialize any context-specific information. */ 
    58    virtual void contextInit() 
    59    {;} 
    60     
     58   virtual void contextInit(); 
     59 
    6160   /** 
    6261    * Callback function for drawing.  Called when the object should be drawn. 
  • juggler/trunk/modules/vrjuggler/vrj/Draw/OGL/GlPipe.cpp

    r19729 r19839  
    362362   // Update the projections for the display using the current app's scale factor 
    363363   // NOTE: This relies upon no other thread trying to update this display at the same time 
    364    float scale_factor = the_app->getDrawScaleFactor(); 
     364   const float scale_factor = the_app->getDrawScaleFactor(); 
    365365   the_display->updateProjections(scale_factor); 
    366366 
     
    382382      win->updateViewport(); 
    383383   } 
     384 
     385   const size_t num_vps = the_display->getNumViewports(); 
    384386 
    385387   // CONTEXT INIT(): Check if we need to call contextInit() 
     
    394396 
    395397      the_app->contextInit();              // Call context init function 
     398 
     399      // Invoke vrj::GlSimInterface::contextInit() for all simulator 
     400      // viewports. 
     401      for ( size_t vp_num = 0; vp_num < num_vps; ++vp_num ) 
     402      { 
     403         Viewport* viewport = the_display->getViewport(vp_num); 
     404 
     405         if ( viewport->isActive() && viewport->isSimulator() ) 
     406         { 
     407            SimViewport* sim_vp = dynamic_cast<SimViewport*>(viewport); 
     408            vprASSERT(NULL != sim_vp); 
     409 
     410            GlSimInterface* draw_sim_i = 
     411               dynamic_cast<GlSimInterface*>(sim_vp->getDrawSimInterface()); 
     412 
     413            if ( NULL != draw_sim_i ) 
     414            { 
     415               draw_sim_i->contextInit(); 
     416            } 
     417         } 
     418      } 
     419 
    396420      win->setDirtyContext(false);        // All clean now 
    397421   } 
     
    413437 
    414438   // --- FOR EACH VIEWPORT -- // 
    415    Viewport* viewport = NULL; 
    416    size_t num_vps = the_display->getNumViewports(); 
    417439   for ( size_t vp_num = 0; vp_num < num_vps; ++vp_num ) 
    418440   { 
    419       viewport = the_display->getViewport(vp_num); 
     441      Viewport* viewport = the_display->getViewport(vp_num); 
    420442 
    421443      // Should viewport be rendered??? 
  • juggler/trunk/modules/vrjuggler/vrj/Draw/OGL/GlSimInterface.h

    r19729 r19839  
    5151 
    5252      /** 
     53       * Provides this simulator interface with an opportunity to perform 
     54       * context-specific initialization. 
     55       * 
     56       * @since 2.1.18 
     57       */ 
     58      virtual void contextInit() 
     59      { 
     60         /* Do nothing. */ ; 
     61      } 
     62 
     63      /** 
    5364       * Draws this sim device using the given information about the Window it 
    5465       * will be drawing into.