GFXWindowTarget *GFXGLDevice::allocWindowTarget( PlatformWindow *window )
{
   AssertFatal(!mContext, "");
   
   init(window->getVideoMode(), window);
   GFXGLWindowTarget *ggwt = new GFXGLWindowTarget(window, this);
   ggwt->registerResourceWithDevice(this);
   ggwt->mContext = mContext;
   AssertFatal(ggwt->mContext, "GFXGLDevice::allocWindowTarget - failed to allocate window target!");

   return ggwt;
}
示例#2
0
GFXWindowTarget *GFXGLDevice::allocWindowTarget( PlatformWindow *window )
{
    AssertFatal(!mContext, "This GFXGLDevice is already assigned to a window");
    
    GFXGLWindowTarget* ggwt = 0;
    if( !mContext )
    {
        // no context, init the device now
        init(window->getVideoMode(), window);
        ggwt = new GFXGLWindowTarget(window, this);
        ggwt->registerResourceWithDevice(this);
        ggwt->mContext = mContext;
    }

    return ggwt;
}
示例#3
0
void GFXGLDevice::_updateRenderTargets()
{
   if ( mRTDirty || mCurrentRT->isPendingState() )
   {
      if ( mRTDeactivate )
      {
         mRTDeactivate->deactivate();
         mRTDeactivate = NULL;   
      }
      
      // NOTE: The render target changes is not really accurate
      // as the GFXTextureTarget supports MRT internally.  So when
      // we activate a GFXTarget it could result in multiple calls
      // to SetRenderTarget on the actual device.
      mDeviceStatistics.mRenderTargetChanges++;

      GFXGLTextureTarget *tex = dynamic_cast<GFXGLTextureTarget*>( mCurrentRT.getPointer() );
      if ( tex )
      {
         tex->applyState();
         tex->makeActive();
      }
      else
      {
         GFXGLWindowTarget *win = dynamic_cast<GFXGLWindowTarget*>( mCurrentRT.getPointer() );
         AssertFatal( win != NULL, 
                     "GFXGLDevice::_updateRenderTargets() - invalid target subclass passed!" );
         
         win->makeActive();
         
         if( win->mContext != static_cast<GFXGLDevice*>(GFX)->mContext )
         {
            mRTDirty = false;
            GFX->updateStates(true);
         }
      }
      
      mRTDirty = false;
   }
   
   if ( mViewportDirty )
   {
      glViewport( mViewport.point.x, mViewport.point.y, mViewport.extent.x, mViewport.extent.y ); 
      mViewportDirty = false;
   }
}
示例#4
0
GFXWindowTarget *GFXGLDevice::allocWindowTarget( PlatformWindow *window )
{
   GFXGLWindowTarget* ggwt = new GFXGLWindowTarget(window, this);

   //first window
   if (!mContext)
   {
      init(window->getVideoMode(), window);
      ggwt->mSecondaryWindow = false;
   }
   else
      ggwt->mSecondaryWindow = true;

   ggwt->registerResourceWithDevice(this);
   ggwt->mContext = mContext;

   return ggwt;
}