VirtualBox

Changeset 23682 in vbox


Ignore:
Timestamp:
Oct 12, 2009 11:26:56 AM (15 years ago)
Author:
vboxsync
Message:

video 2d accel: more intelligent tmp widget creation

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/VBoxFBOverlay.cpp

    r23681 r23682  
    693693//        return;
    694694
    695     static QGLWidget *pTmpContextHolder = NULL;
    696     const bool bHasGlContext = (pContext != NULL);
     695    QGLWidget *pTmpWidget = NULL;
    697696
    698697    if(!pContext)
    699698    {
    700         if(!pTmpContextHolder)
    701         {
    702             QGLWidget *pWidget = new QGLWidget();
    703             pWidget->makeCurrent();
    704             pContext = pWidget->context();
    705             pTmpContextHolder = pWidget;
    706         }
    707 
    708 //        QGLContext * pTmpContext = new QGLContext(QGLFormat::defaultFormat());
    709 //        bool bCreated = pTmpContext->create();
    710 //        Assert(pTmpContext);
    711 //        Assert(pTmpContext->isValid());
    712 //
    713 //        pTmpContext->makeCurrent();
    714 //        pTmpContextHolder = pTmpContext;
     699        QGLWidget *pTmpWidget = new QGLWidget();
     700        pTmpWidget->makeCurrent();
     701        pContext = pTmpWidget->context();
    715702    }
    716703
     
    720707            );
    721708
    722     if(!str)
     709    if(str)
     710    {
     711        VBOXQGLLOGREL (("gl version string: 0%s\n", str));
     712
     713        g_vboxVHWAGlVersion = vboxVHWAGlParseVersion(str);
     714        Assert(g_vboxVHWAGlVersion > 0);
     715        if(g_vboxVHWAGlVersion < 0)
     716        {
     717            g_vboxVHWAGlVersion = 0;
     718        }
     719        else
     720        {
     721            VBOXQGLLOGREL (("gl version: 0x%x\n", g_vboxVHWAGlVersion));
     722            VBOXQGL_CHECKERR(
     723                    str = glGetString(GL_EXTENSIONS);
     724                    );
     725
     726            const char * pos = strstr((const char *)str, "GL_ARB_multitexture");
     727            g_GL_ARB_multitexture = pos != NULL;
     728            VBOXQGLLOGREL (("GL_ARB_multitexture: %d\n", g_GL_ARB_multitexture));
     729
     730            pos = strstr((const char *)str, "GL_ARB_shader_objects");
     731            g_GL_ARB_shader_objects = pos != NULL;
     732            VBOXQGLLOGREL (("GL_ARB_shader_objects: %d\n", g_GL_ARB_shader_objects));
     733
     734            pos = strstr((const char *)str, "GL_ARB_fragment_shader");
     735            g_GL_ARB_fragment_shader = pos != NULL;
     736            VBOXQGLLOGREL (("GL_ARB_fragment_shader: %d\n", g_GL_ARB_fragment_shader));
     737
     738            pos = strstr((const char *)str, "GL_ARB_pixel_buffer_object");
     739            g_GL_ARB_pixel_buffer_object = pos != NULL;
     740            VBOXQGLLOGREL (("GL_ARB_pixel_buffer_object: %d\n", g_GL_ARB_pixel_buffer_object));
     741
     742            pos = strstr((const char *)str, "GL_ARB_texture_rectangle");
     743            g_GL_ARB_texture_rectangle = pos != NULL;
     744            VBOXQGLLOGREL (("GL_ARB_texture_rectangle: %d\n", g_GL_ARB_texture_rectangle));
     745
     746            pos = strstr((const char *)str, "GL_EXT_texture_rectangle");
     747            g_GL_EXT_texture_rectangle = pos != NULL;
     748            VBOXQGLLOGREL (("GL_EXT_texture_rectangle: %d\n", g_GL_EXT_texture_rectangle));
     749
     750            pos = strstr((const char *)str, "GL_NV_texture_rectangle");
     751            g_GL_NV_texture_rectangle = pos != NULL;
     752            VBOXQGLLOGREL (("GL_NV_texture_rectangle: %d\n", g_GL_NV_texture_rectangle));
     753
     754            pos = strstr((const char *)str, "GL_ARB_texture_non_power_of_two");
     755            g_GL_ARB_texture_non_power_of_two = pos != NULL;
     756            VBOXQGLLOGREL (("GL_ARB_texture_non_power_of_two: %d\n", g_GL_ARB_texture_non_power_of_two));
     757
     758            vboxVHWAGlInitExtSupport(*pContext);
     759
     760            vboxVHWAGlInitFeatureSupport();
     761        }
     762    }
     763    else
    723764    {
    724765        VBOXQGLLOGREL (("failed to make the context current, treating as unsupported\n"));
    725         return;
    726     }
    727 
    728     VBOXQGLLOGREL (("gl version string: 0%s\n", str));
    729 
    730     g_vboxVHWAGlVersion = vboxVHWAGlParseVersion(str);
    731     Assert(g_vboxVHWAGlVersion > 0);
    732     if(g_vboxVHWAGlVersion < 0)
    733     {
    734         g_vboxVHWAGlVersion = 0;
    735     }
    736     else
    737     {
    738         VBOXQGLLOGREL (("gl version: 0x%x\n", g_vboxVHWAGlVersion));
    739         VBOXQGL_CHECKERR(
    740                 str = glGetString(GL_EXTENSIONS);
    741                 );
    742 
    743         const char * pos = strstr((const char *)str, "GL_ARB_multitexture");
    744         g_GL_ARB_multitexture = pos != NULL;
    745         VBOXQGLLOGREL (("GL_ARB_multitexture: %d\n", g_GL_ARB_multitexture));
    746 
    747         pos = strstr((const char *)str, "GL_ARB_shader_objects");
    748         g_GL_ARB_shader_objects = pos != NULL;
    749         VBOXQGLLOGREL (("GL_ARB_shader_objects: %d\n", g_GL_ARB_shader_objects));
    750 
    751         pos = strstr((const char *)str, "GL_ARB_fragment_shader");
    752         g_GL_ARB_fragment_shader = pos != NULL;
    753         VBOXQGLLOGREL (("GL_ARB_fragment_shader: %d\n", g_GL_ARB_fragment_shader));
    754 
    755         pos = strstr((const char *)str, "GL_ARB_pixel_buffer_object");
    756         g_GL_ARB_pixel_buffer_object = pos != NULL;
    757         VBOXQGLLOGREL (("GL_ARB_pixel_buffer_object: %d\n", g_GL_ARB_pixel_buffer_object));
    758 
    759         pos = strstr((const char *)str, "GL_ARB_texture_rectangle");
    760         g_GL_ARB_texture_rectangle = pos != NULL;
    761         VBOXQGLLOGREL (("GL_ARB_texture_rectangle: %d\n", g_GL_ARB_texture_rectangle));
    762 
    763         pos = strstr((const char *)str, "GL_EXT_texture_rectangle");
    764         g_GL_EXT_texture_rectangle = pos != NULL;
    765         VBOXQGLLOGREL (("GL_EXT_texture_rectangle: %d\n", g_GL_EXT_texture_rectangle));
    766 
    767         pos = strstr((const char *)str, "GL_NV_texture_rectangle");
    768         g_GL_NV_texture_rectangle = pos != NULL;
    769         VBOXQGLLOGREL (("GL_NV_texture_rectangle: %d\n", g_GL_NV_texture_rectangle));
    770 
    771         pos = strstr((const char *)str, "GL_ARB_texture_non_power_of_two");
    772         g_GL_ARB_texture_non_power_of_two = pos != NULL;
    773         VBOXQGLLOGREL (("GL_ARB_texture_non_power_of_two: %d\n", g_GL_ARB_texture_non_power_of_two));
    774 
    775         vboxVHWAGlInitExtSupport(*pContext);
    776 
    777         vboxVHWAGlInitFeatureSupport();
    778     }
    779 
    780     if(!bHasGlContext)
    781     {
    782         pTmpContextHolder->doneCurrent();
     766    }
     767
     768
     769    if(pTmpWidget)
     770    {
     771        delete pTmpWidget;
    783772    }
    784773}
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette