void
CPatchEngine::Initialize( void )
{GUCEF_TRACE;

    assert( m_patchListEngine != NULL );

    RegisterEvents();

    // Forward events from the list engine
    AddForwardingForEvent( PatchListProcessingStartedEvent, EVENTORIGINFILTER_UNMODIFIED );
    AddForwardingForEvent( PatchListProcessingProgressEvent, EVENTORIGINFILTER_UNMODIFIED );
    AddForwardingForEvent( PatchListProcessingCompletedEvent, EVENTORIGINFILTER_UNMODIFIED );
    AddForwardingForEvent( PatchListProcessingAbortedEvent, EVENTORIGINFILTER_UNMODIFIED );
    AddForwardingForEvent( PatchListProcessingFailedEvent, EVENTORIGINFILTER_UNMODIFIED );
    AddForwardingForEvent( PatchSetDataRecievedEvent, EVENTORIGINFILTER_UNMODIFIED );
    AddForwardingForEvent( PatchSetRetrievalStartedEvent, EVENTORIGINFILTER_UNMODIFIED );
    AddForwardingForEvent( PatchSetRetrievalCompletedEvent, EVENTORIGINFILTER_UNMODIFIED );
    AddForwardingForEvent( PatchSetRetrievalFailedEvent, EVENTORIGINFILTER_UNMODIFIED );
    AddForwardingForEvent( PatchSetRetrievalAbortedEvent, EVENTORIGINFILTER_UNMODIFIED );
    AddForwardingForEvent( PatchSetDecodingFailedEvent, EVENTORIGINFILTER_UNMODIFIED );

    // Forward events from the set engine
    AddForwardingForEvent( PatchSetProcessingStartedEvent, EVENTORIGINFILTER_UNMODIFIED );
    AddForwardingForEvent( PatchSetProcessingProgressEvent, EVENTORIGINFILTER_UNMODIFIED );
    AddForwardingForEvent( PatchSetProcessingCompletedEvent, EVENTORIGINFILTER_UNMODIFIED );
    AddForwardingForEvent( PatchSetProcessingAbortedEvent, EVENTORIGINFILTER_UNMODIFIED );
    AddForwardingForEvent( PatchSetProcessingFailedEvent, EVENTORIGINFILTER_UNMODIFIED );

    // Forward events from the dir engines
    AddForwardingForEvent( DirProcessingStartedEvent, EVENTORIGINFILTER_UNMODIFIED );
    AddForwardingForEvent( DirProcessingProgressEvent, EVENTORIGINFILTER_UNMODIFIED );
    AddForwardingForEvent( DirProcessingCompletedEvent, EVENTORIGINFILTER_UNMODIFIED );
    AddForwardingForEvent( SubDirProcessingStartedEvent, EVENTORIGINFILTER_UNMODIFIED );
    AddForwardingForEvent( SubDirProcessingCompletedEvent, EVENTORIGINFILTER_UNMODIFIED );

    // Forward file engine events
    AddForwardingForEvent( FileListProcessingStartedEvent, EVENTORIGINFILTER_UNMODIFIED );
    AddForwardingForEvent( LocalFileIsOKEvent, EVENTORIGINFILTER_UNMODIFIED );
    AddForwardingForEvent( LocalFileSizeMismatchEvent, EVENTORIGINFILTER_UNMODIFIED );
    AddForwardingForEvent( LocalFileHashMismatchEvent, EVENTORIGINFILTER_UNMODIFIED );
    AddForwardingForEvent( LocalFileNotFoundEvent, EVENTORIGINFILTER_UNMODIFIED );
    AddForwardingForEvent( LocalFileReplacedEvent, EVENTORIGINFILTER_UNMODIFIED );
    AddForwardingForEvent( FileRetrievalStartedEvent, EVENTORIGINFILTER_UNMODIFIED );
    AddForwardingForEvent( FileRetrievalProgressEvent, EVENTORIGINFILTER_UNMODIFIED );
    AddForwardingForEvent( FileRetrievalCompleteEvent, EVENTORIGINFILTER_UNMODIFIED );
    AddForwardingForEvent( FileRetrievalErrorEvent, EVENTORIGINFILTER_UNMODIFIED );
    AddForwardingForEvent( FileStorageErrorEvent, EVENTORIGINFILTER_UNMODIFIED );
    AddForwardingForEvent( FileListProcessingCompleteEvent, EVENTORIGINFILTER_UNMODIFIED );
    AddForwardingForEvent( FileListProcessingAbortedEvent, EVENTORIGINFILTER_UNMODIFIED );

    SubscribeTo( &m_url );

    // Subscribe to all events from the patch list engine
    // This should allow us to receive all events that we wish to forward
    SubscribeTo( m_patchListEngine );
}
示例#2
0
CGUIManager::CGUIManager( void )
        : CIConfigurable( true ) ,
          m_initialized( false ) ,
          m_drivers()            ,
          m_selectedDriverName() ,
          m_guiConfig()
{GUCE_TRACE;

    RegisterEvents();    
    SubscribeTo( CORE::CGUCEApplication::Instance() );
    SubscribeTo( GUCEF::GUI::CGUIManager::Instance() );
}
示例#3
0
void
CDRNNode::GetAvailableTCPClient( COMCORE::CTCPClientSocket** tcpClient ,
                                 UInt32& socketIndex                   )
{GUCEF_TRACE;

    // Try to find an inactive socket object we can re-use
    UInt32 index = 0;
    TTCPClients::iterator i = m_tcpClientSockets.begin();
    while ( i != m_tcpClientSockets.end() )
    {
        if ( !(*i)->IsActive() )
        {
            // Assign output values
            *tcpClient = *i;
            socketIndex = index;
            return;
        }
        ++i; ++index;
    }
    
    // no such luck,.. we will create a new TCP client socket
    COMCORE::CTCPClientSocket* clientSocket = new COMCORE::CTCPClientSocket( false );
    SubscribeTo( clientSocket );    
    m_tcpClientSockets.push_back( clientSocket );
    
    // Assign output values
    socketIndex = (Int32)m_tcpClientSockets.size() - 1;
    *tcpClient = clientSocket;
}
示例#4
0
Navigator::Navigator( CommandDispatcher* pCD, Position* pOd, WaypointManager* pWM ) : Behavior( pCD )
{
    _pPosition = pOd;
    _pWaypointManager = pWM;

    _pName = F("Navigator");
    _pHelpString = F(  "  T <degrees> : set heading tolerance\n"
                        "  R : restart at first waypoint" 
                        );

    // we need to subscribe to events from the two Publishers
    SubscribeTo( pCD, 'N' );

    // get our initial waypoint
    _waypointNumber = 0;
    _pCurrentWaypoint = _pWaypointManager->GetWaypoint( _waypointNumber );

    _eState = eNormal;
    _bCorrecting = false;
//    _bAtDestination = false;

    _headingTolerance = 2.0 * PI / 180;   // 5°, in radians

    _brakingFactor = 0.25;    // for heading adjustments, slow one side by this factor.
}
void Switchboard::SendAllMessages()
{
	_messagesLocked = true;
	while (!_messages.empty())
	{
		String frontMessageName = _messages.front()->GetMessageName();
		if (_subscribers.find(frontMessageName) != _subscribers.end())
		{
			std::set<MessageListener*>::iterator listenIt = _subscribers[frontMessageName].begin();
			while (listenIt != _subscribers[frontMessageName].end())
			{
				(*listenIt)->ReceiveMessage(_messages.front());
				listenIt++;
			}
		}
		delete _messages.front();
		_messages.pop();
	}
	_messagesLocked = false;
	
	for(unsigned int i = 0; i < _deferredRemoves.size(); i++)
	{
		UnsubscribeFrom(_deferredRemoves[i]._subscriber, _deferredRemoves[i]._messageType);
	}
	_deferredRemoves.clear();
	
	for(unsigned int i = 0; i < _deferredAdds.size(); i++)
	{
		SubscribeTo(_deferredAdds[i]._subscriber, _deferredAdds[i]._messageType);
	}
	_deferredAdds.clear();
}
CCodecBasedProductInfoListProvider::CCodecBasedProductInfoListProvider()
    : CProductInfoListProvider(),
      m_codecToUse( "xml" ),
      m_dataRetriever()
{GUCEF_TRACE;

    SubscribeTo( &m_dataRetriever );
}
示例#7
0
CRefAppSubSystem::CRefAppSubSystem( void )
    : CObservingNotifier() ,
      //m_console( NULL )          ,
      m_debugOverlay( NULL )
{GUCE_TRACE;

    SubscribeTo( GUCE::GUI::CGUIManager::Instance(), GUCE::GUI::CGUIManager::GUIInitializedEvent );
}
CWin32WindowContext::CWin32WindowContext( void )
    : CWindowContext()         ,
      m_guiContext()           ,
      m_id()                   ,
      m_name()                 ,
      m_window()               
{GUCEF_TRACE;

    SubscribeTo( &m_window );
}
CLogSvcClient::CLogSvcClient( CORE::CPulseGenerator& pulseGenerator )
    : CLoggingTask()                       ,
      m_tcpClient( pulseGenerator, false ) ,
      m_appName( "Unknown" )               ,
      m_connectionInitialized( false )
{GUCEF_TRACE;

    RegisterEvents();

    SubscribeTo( &m_tcpClient );
}
CLogSvcClient::CLogSvcClient( void )
    : CLoggingTask()                   ,
      m_tcpClient( false )             ,
      m_appName( "Unknown" )           ,
      m_connectionInitialized( false )
{GUCEF_TRACE;

    RegisterEvents();

    SubscribeTo( &m_tcpClient );
}
CGUIContextGL::CGUIContextGL( CGUIDriverGL& guiDriver                   ,
                              GUI::TWindowContextPtr windowContext      ,
                              INPUT::CInputContext* inputContext        ,
                              CEGUI::GUIContext* ceGuiContext           )
    : GUIDRIVERCEGUI::CGUIContext( guiDriver    ,
                                   inputContext ,
                                   ceGuiContext )  ,
      m_windowContext( windowContext ) 
{GUCEF_TRACE;

    SubscribeTo( m_windowContext.GetPointer() );
}
示例#12
0
CDRNNode::CDRNNode( void )
    : CObservingNotifier()               ,
      m_tcpServerSocket( false )         ,
      m_tcpClientSockets()               ,
      m_udpSocket( false )               ,
      m_peerValidator( NULL )            ,
      m_peerLinkCrypter( NULL )          ,
      m_peerLinkList()                   ,
      m_dataGroupList()                  ,
      m_dataStreamList()                 ,
      m_overrideConnectBack( false )     ,
      m_overrideHost( "127.0.0.1" ,
                      53456       )      ,
      m_overrideUDPPort( 53457 )
{GUCEF_TRACE;
    
    RegisterEvents();

    SubscribeTo( &m_tcpServerSocket );
    SubscribeTo( &m_udpSocket );
}
CXWinGLWindowContext::CXWinGLWindowContext( void )
    : CWindowContext()         ,
      m_guiContext()           ,
      m_id()                   ,
      m_name()                 ,
      m_window()              // ,
      //m_renderContext( NULL )  ,
      //m_deviceContext( NULL )
{GUCEF_TRACE;

    SubscribeTo( &m_window );
}
void
CLogSvcServer::RegisterServerSocketEventHandlers( void )
{
    TEventCallback callback( this, &CLogSvcServer::OnServerSocketClientConnected );
    SubscribeTo( &m_tcpServer                                    ,
                 COMCORE::CTCPServerSocket::ClientConnectedEvent ,
                 callback                                        );
    TEventCallback callback2( this, &CLogSvcServer::OnServerSocketClientDisconnected );
    SubscribeTo( &m_tcpServer                                       ,
                 COMCORE::CTCPServerSocket::ClientDisconnectedEvent ,
                 callback2                                          );
    TEventCallback callback3( this, &CLogSvcServer::OnServerSocketClientError );
    SubscribeTo( &m_tcpServer                                ,
                 COMCORE::CTCPServerSocket::ClientErrorEvent ,
                 callback3                                   );
    TEventCallback callback4( this, &CLogSvcServer::OnServerSocketServerSocketClosed );
    SubscribeTo( &m_tcpServer                                       ,
                 COMCORE::CTCPServerSocket::ServerSocketClosedEvent ,
                 callback4                                          );
    TEventCallback callback5( this, &CLogSvcServer::OnServerSocketServerSocketError );
    SubscribeTo( &m_tcpServer                                      ,
                 COMCORE::CTCPServerSocket::ServerSocketErrorEvent ,
                 callback5                                         );
    TEventCallback callback6( this, &CLogSvcServer::OnServerSocketServerSocketClientError );
    SubscribeTo( &m_tcpServer                                            ,
                 COMCORE::CTCPServerSocket::ServerSocketClientErrorEvent ,
                 callback6                                               );
}
示例#15
0
COgreWindowContext::COgreWindowContext( void )
    : CWindowContext()         ,
      m_guiContext()           ,
      m_id()                   ,
      m_name()                 ,
      m_osWindow( 0 )          ,
      m_renderWindow( 0 )      ,
      m_initialized( false )
{GUCEF_TRACE;

    m_osWindow = CORE::COSWindow::Create();
    SubscribeTo( m_osWindow );
}
CGUIContextOgre::CGUIContextOgre( CGUIDriverOgre& guiDriver                 ,
                                  GUI::TWindowContextPtr windowContext      ,
                                  INPUT::CInputContext* inputContext        ,
                                  CEGUI::GUIContext* ceGuiContext           )
    : GUIDRIVERCEGUI::CGUIContext( guiDriver    ,
                                   inputContext ,
                                   ceGuiContext )  ,
      m_windowContext( windowContext ),
      m_lastTimeInjection( clock() ) 
{GUCEF_TRACE;

    SubscribeTo( m_windowContext.GetPointer() );
}
void
CLogSvcServer::RegisterClientConnectionEventHandlers( COMCORE::CTCPServerConnection* connection )
{GUCEF_TRACE;

    TEventCallback callback( this, &CLogSvcServer::OnClientConnectionDataReceived );
    SubscribeTo( connection                                       ,
                 COMCORE::CTCPServerConnection::DataRecievedEvent ,
                 callback                                         );

    //static const CORE::CEvent ConnectedEvent;
    //static const CORE::CEvent DisconnectedEvent;
    //static const CORE::CEvent DataSentEvent;
    //static const CORE::CEvent SocketErrorEvent;
}
示例#18
0
bool
CHTTPURLHandler::Activate( CORE::CURL& url )
{GUCEF_TRACE;

    GUCEF_DEBUG_LOG( CORE::LOGLEVEL_NORMAL, "CHTTPURLHandler(" + CORE::PointerToString( this ) + "): Activating using URL: " + url.GetURL() );

    m_transferFinished = false;

    delete m_httpClient;
    m_httpClient = new CHTTPClient( url.GetPulseGenerator() );
    SubscribeTo( m_httpClient );

    return m_httpClient->Get( url.GetURL() );
}
CruiseControl::CruiseControl( CommandDispatcher* pCD, Position* pOD, float IPS2Ticks ) : Actor( pCD ) 
{
    _pPosition = pOD;
    _IPS2Ticks = IPS2Ticks;

    _kP = 1.0;
    _kI = 0.5;
    _kD = 0.0;

    _pName = "Cruise Control";
    _bCruising = false;

    SubscribeTo( pCD, 'C' );    // All our commands begin with "C"
}
示例#20
0
CruiseControl::CruiseControl( CommandDispatcher* pCD, Position* pOD ) : Behavior( pCD )
{
    _pPosition = pOD;

    _kP = 1.0;
    _kI = 0.5;
    _kD = 0.0;

    _pName = F("Cruise Control");
    _pHelpString =  F(  "  S <Speed> : Set cruising speed (IPS)\n"
                        "  P <kP> <kI> <kD> : Set PID coefficients"
                     );

    _bCruising = false;

    SubscribeTo( pCD, 'C' );    // All our commands begin with "C"
}
示例#21
0
文件: node.cpp 项目: MyOwnClone/logog
	bool Node::SubscribeToMultiple( LockableNodesType &nodes )
	{
		LockableNodesType::iterator it;

		bool bWasSubscribed = false;

		nodes.MutexLock();
		it = nodes.begin();

		while ( it != nodes.end() )
		{
			if ( SubscribeTo( **it ) == true )
				bWasSubscribed = true;

			++it;
		}

		nodes.MutexUnlock();

		return bWasSubscribed;
	}
void
CVideoSettingsForm::OnPostLayoutLoad( void )
{GUCE_TRACE;

    m_resolutionLabel = static_cast< GUCEF::GUI::CLabel* >( GetWidget( "ResolutionLabel" ) );
    m_resolutionCombobox = static_cast< GUCEF::GUI::CCombobox* >( GetWidget( "ResolutionCombobox" ) );
    m_antiAliasingLabel = static_cast< GUCEF::GUI::CLabel* >( GetWidget( "AntiAliasingLabel" ) );
    m_antiAliasingCombobox = static_cast< GUCEF::GUI::CCombobox* >( GetWidget( "AntiAliasingCombobox" ) );
    m_fullscreenCheckbox = static_cast< GUCEF::GUI::CCheckbox* >( GetWidget( "FullscreenCheckbox" ) );
    m_vSyncCheckbox = static_cast< GUCEF::GUI::CCheckbox* >( GetWidget( "vSyncCheckbox" ) );
    m_applyButton = static_cast< GUCEF::GUI::CButton* >( GetWidget( "ApplyButton" ) );
    
    SubscribeTo( m_resolutionLabel );
    SubscribeTo( m_resolutionCombobox );
    SubscribeTo( m_antiAliasingLabel );
    SubscribeTo( m_antiAliasingCombobox );
    SubscribeTo( m_fullscreenCheckbox );
    SubscribeTo( m_vSyncCheckbox );
    SubscribeTo( m_applyButton );
}
bool
CWin32WindowContext::Initialize( const GUI::CString& title                ,
                                     const GUI::CVideoSettings& videoSettings )
{GUCEF_TRACE;

    // Do not initialize twice
    Shutdown();

    if ( !CORE::CMsWin32Window::RegisterWindowClass( GetClassTypeName() ) )
    {
        GUCEF_ERROR_LOG( CORE::LOGLEVEL_NORMAL, "Win32WindowContext: Could not register window class" );
        return false;
    }

    // First create a regular Win32 window
    if ( m_window.WindowCreate( GetClassTypeName()                          ,
                                title                                       ,
                                0                                           ,
                                0                                           ,
                                videoSettings.GetResolutionWidthInPixels()  ,
                                videoSettings.GetResolutionHeightInPixels() ) )
    {
        // Display the new window
        m_window.Show();
        m_window.SendToForegound();
        m_window.GrabFocus();

        // Grab the main app pulse generator and set the update interval for the context to the desired refresh rate
        CORE::CPulseGenerator& pulseGenerator = CORE::CCoreGlobal::Instance()->GetPulseGenerator(); 
        pulseGenerator.RequestPeriodicPulses( this, 1000 / videoSettings.GetFrequency() );
        SubscribeTo( &pulseGenerator );

        GUCEF_SYSTEM_LOG( CORE::LOGLEVEL_NORMAL, "Win32WindowContext: Succesfully created Win32 window" );
        return true;
    }
    return false;
}
示例#24
0
bool
CDRNNode::ConnectToPeer( const COMCORE::CHostAddress& hostAddress )
{GUCEF_TRACE;

    // Check if a peer validation mechanism has been provided to this node
    if ( m_peerValidator != NULL )
    {            
        // Check if the peer connection is allowed
        if ( !m_peerValidator->IsPeerAddressValid( hostAddress ) )
        {   
            return false;
        }
    }

    // Obtain a TCP client socket
    COMCORE::CTCPClientSocket* tcpClient = NULL;
    UInt32 socketIndex = 0;
    GetAvailableTCPClient( &tcpClient  ,
                           socketIndex );
            
    // Attempt the connection
    SubscribeTo( tcpClient );
    return tcpClient->ConnectTo( hostAddress );
}
示例#25
0
bool
COgreWindowContext::Initialize( const GUI::CString& title                ,
                                const GUI::CVideoSettings& videoSettings ,
                                const GUI::CString& ogreRenderSystem     )
{GUCEF_TRACE;

    // Do not initialize twice
    Shutdown();

    // First create a regular O/S window
    if ( m_osWindow->WindowCreate( title                                       ,
                                   0                                           ,
                                   0                                           ,
                                   videoSettings.GetResolutionWidthInPixels()  ,
                                   videoSettings.GetResolutionHeightInPixels() ) )
    {
        // Display the new window
        m_osWindow->Show();
        m_osWindow->SendToForegound();
        m_osWindow->GrabFocus();

	    // Now proceed with setting up the Ogre specifics
        
        // We grab the O/S window identifier 'the handle' 
        // This is passed to Ogre to tie things together
        CORE::Int64 windowRef = 0; 
        CORE::CString windowIntStr = m_osWindow->GetProperty( "WINDOWINT" );
        if ( !windowIntStr.IsNULLOrEmpty() )
        {
            windowRef = CORE::StringToInt64( windowIntStr );
        }
        Ogre::NameValuePairList options;         
        options[ "externalWindowHandle" ] = Ogre::StringConverter::toString( (size_t) windowRef ); 

        Ogre::Root* ogreRoot = Ogre::Root::getSingletonPtr();
        if ( ogreRoot == nullptr )
        {            
            ogreRoot = OGRE_NEW Ogre::Root( "", "", "" ); 
        }

        if ( !ogreRoot->isInitialised() )
        {
            // Load any Ogre plugins not loaded yet from the bootstrap group
            CORE::CCoreGlobal::Instance()->GetPluginControl().LoadPluginGroup( "Ogre" );
            
            const Ogre::RenderSystemList& rsList = ogreRoot->getAvailableRenderers();
            if ( rsList.size() == 0 )
            {
                GUCEF_ERROR_LOG( CORE::LOGLEVEL_IMPORTANT, "OgreWindowContext: No Ogre render systems are available, cannot initialize" );
                return false;
            }

            Ogre::RenderSystem* renderSystem = nullptr;
            Ogre::RenderSystemList::const_iterator i = rsList.begin();
            while ( i != rsList.end() )
            {
                GUCEF_SYSTEM_LOG( CORE::LOGLEVEL_NORMAL, "OgreWindowContext: Available Ogre render system: " + (*i)->getFriendlyName() );
                if ( ogreRenderSystem == (*i)->getName() )
                {
                    GUCEF_SYSTEM_LOG( CORE::LOGLEVEL_NORMAL, "OgreWindowContext: Found desired/preferred Ogre render system: " + (*i)->getFriendlyName() );
                    renderSystem = (*i); 
                }
                ++i;
            }
            if ( renderSystem == nullptr )
            {
                GUCEF_WARNING_LOG( CORE::LOGLEVEL_IMPORTANT, "OgreWindowContext: Preferred Ogre render systems not available, using first available alternative: " + (*rsList.begin())->getFriendlyName() );
                renderSystem = *rsList.begin();
            }

            ogreRoot->setRenderSystem( renderSystem );
            m_sceneManager = ogreRoot->createSceneManager( Ogre::ST_GENERIC );

            m_renderWindow = ogreRoot->initialise( false, title );
        }

        m_renderWindow = ogreRoot->createRenderWindow( title, 
                                                       videoSettings.GetResolutionWidthInPixels(), 
                                                       videoSettings.GetResolutionHeightInPixels(), 
                                                       videoSettings.GetFullscreenState(),
                                                       &options ); 

        // Grab the main app pulse generator and set the update interval for the context to the desired refresh rate
        CORE::CPulseGenerator& pulseGenerator = CORE::CCoreGlobal::Instance()->GetPulseGenerator(); 
        pulseGenerator.RequestPeriodicPulses( this, 1000 / videoSettings.GetFrequency() );
        SubscribeTo( &pulseGenerator );

        GUCEF_SYSTEM_LOG( CORE::LOGLEVEL_NORMAL, "OgreWindowContext: Succesfully created Ogre rendering context" );
        m_initialized = true;
        return true;
    }
    return false;
}
bool
CXWinGLWindowContext::Initialize( const GUI::CString& title                ,
                                  const GUI::CVideoSettings& videoSettings )
{GUCEF_TRACE;

    // Do not initialize twice
    Shutdown();

    // First get access to the display
    ::Display* display = CORE::CX11EventDispatcher::Instance()->GetDisplay();
    if ( NULL == display )
    {
        GUCEF_ERROR_LOG( CORE::LOGLEVEL_NORMAL, "CXWinGLWindowContext: Could not open display" );
        return false;
    }

    // Now proceed with setting up the OpenGL specifics
    int dummy = 0;
    if ( 0 == glXQueryExtension( display, &dummy, &dummy ) )
    {
        GUCEF_ERROR_LOG( CORE::LOGLEVEL_NORMAL, "CXWinGLWindowContext: X server has no OpenGL GLX extension" );
        Shutdown();
        return false;
    }

    // find an OpenGL-capable Color Index visual with depth buffer
    static int attributes[] = {GLX_RGBA, GLX_DOUBLEBUFFER, None};
    //static int attributes[] = {GLX_DEPTH_SIZE, 16, GLX_DOUBLEBUFFER, None};
    XVisualInfo* vi = glXChooseVisual( display, DefaultScreen( display ), attributes );
    if ( NULL == vi )
    {
        GUCEF_ERROR_LOG( CORE::LOGLEVEL_NORMAL, "CXWinGLWindowContext: Could not get visual info for display" );
        Shutdown();
        return false;
    }

    // create an OpenGL rendering context
    GLXContext cx = glXCreateContext( display, vi,  None, GL_TRUE );
    if ( NULL == cx )
    {
        GUCEF_ERROR_LOG( CORE::LOGLEVEL_NORMAL, "CXWinGLWindowContext: Could not create rendering context" );
        XFree( vi );
        Shutdown();
        return false;
    }
    GUCEF_DEBUG_LOG( CORE::LOGLEVEL_NORMAL, "CXWinGLWindowContext: Created GL context using GLX" );

    // create an X colormap since probably not using default visual
    ::Colormap cmap = ::XCreateColormap( display, RootWindow( display, vi->screen),
                                vi->visual, AllocNone);

    ::XSetWindowAttributes swa;
    swa.colormap = cmap;
    swa.border_pixel = 0;
    swa.event_mask = ExposureMask | EnterWindowMask | StructureNotifyMask | SubstructureNotifyMask;

    ::Window glwin = ::XCreateWindow(display, RootWindow(display, vi->screen), 0, 0, videoSettings.GetResolutionWidthInPixels(),
                        videoSettings.GetResolutionHeightInPixels(), 0, vi->depth, InputOutput, vi->visual,
                        CWBorderPixel | CWColormap | CWEventMask, &swa);
    if ( 0 == glwin )
    {
        GUCEF_ERROR_LOG( CORE::LOGLEVEL_NORMAL, "CXWinGLWindowContext: Failed to create X11 window" );
        ::XFree( vi );
        Shutdown();
        return false;
    }
    GUCEF_DEBUG_LOG( CORE::LOGLEVEL_NORMAL, "CXWinGLWindowContext: Created X11 Window" );

//    ::XSetStandardProperties(display, glwin, "xogl", "xogl", None, 0,
//                                0, NULL);

    glXMakeCurrent( display, glwin, cx );

    // Set up the default GL state.
    glClearColor(0, 0, 0, 1);
    //glEnableClientState( GL_VERTEX_ARRAY );
    //glEnableClientState( GL_COLOR_ARRAY );

    //glEnable( GL_BLEND );
    //glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );

    glMatrixMode( GL_PROJECTION );
    glLoadIdentity();
    glOrtho( 0, GetWidth(), GetHeight(), 0, -1, 1 );

    glMatrixMode( GL_MODELVIEW );
    glLoadIdentity();

    // Hook up our window object to re-use its eventing capabilities
    m_window.SetDisplay( display );
    m_window.SetScreen( vi->screen );
    m_window.SetWindow( glwin );
    m_window.SetText( title );

    // cleanup
    ::XFree( vi );

    // Display the new window
    m_window.Show();
    m_window.SendToForegound();
    //m_window.GrabFocus();

    // Grab the main app pulse generator and set the update interval for the context to the desired refresh rate
    CORE::CPulseGenerator& pulseGenerator = CORE::CCoreGlobal::Instance()->GetPulseGenerator();
    pulseGenerator.RequestPeriodicPulses( this, 1000 / videoSettings.GetFrequency() );
    SubscribeTo( &pulseGenerator, CORE::CPulseGenerator::PulseEvent );

    GUCEF_SYSTEM_LOG( CORE::LOGLEVEL_NORMAL, "CXWinGLWindowContext: Succesfully created OpenGL rendering context" );

    return true;
}