Example #1
0
bool Window::configInit()
{
    GLXFBConfig* fbConfig = chooseGLXFBConfig();
    if( !fbConfig )
    {
        sendError( ERROR_SYSTEMWINDOW_PIXELFORMAT_NOTFOUND );
        return false;
    }

    GLXContext context = createGLXContext( fbConfig );
    setGLXContext( context );
    if( !context )
    {
        XFree( fbConfig );
        return false;
    }

    bool success = configInitGLXDrawable( fbConfig );
    XFree( fbConfig );

    if( !success || !_impl->xDrawable )
    {
        sendError( ERROR_GLXWINDOW_NO_DRAWABLE );
        return false;
    }

    makeCurrent();
    initGLEW();
    _initSwapSync();
    if( getIAttribute( IATTR_HINT_DRAWABLE ) == FBO )
        success = configInitFBO();

    return success;
}
Example #2
0
AGLContext Window::createAGLContext( AGLPixelFormat pixelFormat )
{
    if( !pixelFormat )
    {
        sendError( ERROR_SYSTEMWINDOW_NO_PIXELFORMAT );
        return 0;
    }

    const WindowIF* aglShareWindow =
        dynamic_cast< const WindowIF* >( getSharedContextWindow( ));
    AGLContext shareCtx = aglShareWindow ? aglShareWindow->getAGLContext() : 0;

    Global::enterCarbon();
    AGLContext context = aglCreateContext( pixelFormat, shareCtx );

    if( !context )
    {
        sendError( ERROR_AGLWINDOW_CREATECONTEXT_FAILED ) << aglError();
        Global::leaveCarbon();
        return 0;
    }

    _initSwapSync( context );
    aglSetCurrentContext( context );

    Global::leaveCarbon();

    LBVERB << "Created AGL context " << context << " shared with " << shareCtx
           << std::endl;
    return context;
}
Example #3
0
AGLContext Window::createAGLContext( AGLPixelFormat pixelFormat )
{
    if( !pixelFormat )
    {
        setError( ERROR_SYSTEMWINDOW_NO_PIXELFORMAT );
        return 0;
    }

    AGLContext shareCtx = 0;
    const eq::Window* shareWindow = getWindow()->getSharedContextWindow();
    const SystemWindow* sysWindow =
        shareWindow ? shareWindow->getSystemWindow() :0;
    if( sysWindow )
    {
        const WindowIF* aglShareWindow = LBSAFECAST(const WindowIF*, sysWindow);
        shareCtx = aglShareWindow->getAGLContext();
    }
 
    Global::enterCarbon();
    AGLContext context = aglCreateContext( pixelFormat, shareCtx );

    if( !context ) 
    {
        setError( ERROR_AGLWINDOW_CREATECONTEXT_FAILED );
        LBWARN << getError() << ": " << AGLERROR << std::endl;
        Global::leaveCarbon();
        return 0;
    }

    _initSwapSync( context );
    aglSetCurrentContext( context );

    Global::leaveCarbon();

    LBVERB << "Created AGL context " << context << " shared with " << shareCtx
           << std::endl;
    return context;
}