Example #1
0
   void OSGGraphicsWindowQt::SetQGLWidget(QGLWidget* qwidget)
   {
      
      if (mQWidget != NULL && getState() != NULL)
      {
         delete mQWidget;
         mQWidget = NULL;
         decrementContextIDUsageCount(getState()->getContextID());
         setState(NULL);
      }

      mQWidget = qwidget;

      mValid = mQWidget != NULL;

      if (valid())
      {
          setState( new osg::State );
          getState()->setGraphicsContext(this);

          if (_traits.valid() && _traits->sharedContext)
          {
              getState()->setContextID( _traits->sharedContext->getState()->getContextID() );
              incrementContextIDUsageCount( getState()->getContextID() );
          }
          else
          {
              getState()->setContextID( osg::GraphicsContext::createNewContextID() );
          }
      }
   }
GraphicsWindowSDL2::GraphicsWindowSDL2(osg::GraphicsContext::Traits *traits)
    : mWindow(0)
    , mContext(0)
    , mValid(false)
    , mRealized(false)
    , mOwnsWindow(false)
{
    _traits = traits;

    init();
    if(valid())
    {
        setState(new osg::State);
        getState()->setGraphicsContext(this);

        if(_traits.valid() && _traits->sharedContext.valid())
        {
            getState()->setContextID(_traits->sharedContext->getState()->getContextID());
            incrementContextIDUsageCount(getState()->getContextID());
        }
        else
        {
            getState()->setContextID(osg::GraphicsContext::createNewContextID());
        }
    }
}
Example #3
0
void GraphicsWindowWX::init()
{
    if( valid() )
    {
        setState( new osg::State );
        getState()->setGraphicsContext( this );

        if( _traits.valid() && _traits->sharedContext )
        {
            getState()->setContextID( _traits->sharedContext->getState()->getContextID() );
            incrementContextIDUsageCount( getState()->getContextID() );
        }
        else
        {
            getState()->setContextID( osg::GraphicsContext::createNewContextID() );
        }
    }
}
Example #4
0
GraphicsWindowQt::GraphicsWindowQt( osg::GraphicsContext::Traits* traits )
    :   _widget(0),
        _initialized(false),
        _realized(false)
{
    _traits = traits;
    _initialized = init();

    if ( valid() )
    {
        setState( new osg::State );
        getState()->setGraphicsContext(this);

        if ( _traits.valid() && _traits->sharedContext )
        {
            getState()->setContextID( _traits->sharedContext->getState()->getContextID() );
            incrementContextIDUsageCount( getState()->getContextID() );
        }
        else
        {
            getState()->setContextID( osg::GraphicsContext::createNewContextID() );
        }
    }
}