VirtualBox

Ignore:
Timestamp:
Jun 21, 2020 6:41:16 PM (5 years ago)
Author:
vboxsync
Message:

FE/Qt,Devices/Graphics: experimental GLX graphics output: use TEXTURE_2D

File:
1 edited

Legend:

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

    r84800 r84888  
    171171
    172172    /* The guest texture OpenGL target. */
    173     static GLenum const kTextureTarget = GL_TEXTURE_RECTANGLE;
     173    static GLenum const kTextureTarget = GL_TEXTURE_2D;
    174174
    175175    /* The the guest screen source. */
     
    676676                    GLX_DRAWABLE_TYPE,               GLX_PIXMAP_BIT,         // Must support GLX pixmaps
    677677                    GLX_BIND_TO_TEXTURE_RGBA_EXT,    True,                   // Must support GLX_EXT_texture_from_pixmap
    678                     GLX_BIND_TO_TEXTURE_TARGETS_EXT, GLX_TEXTURE_RECTANGLE_BIT_EXT, // Must support GL_TEXTURE_RECTANGLE for the frontend code
     678                    GLX_BIND_TO_TEXTURE_TARGETS_EXT, GLX_TEXTURE_2D_BIT_EXT, // Must support GL_TEXTURE_2D because the device creates the pixmap as TEXTURE_2D
    679679                    GLX_DOUBLEBUFFER,                False,                  // No need for double buffering for a pixmap.
    680680                    GLX_RED_SIZE,                    8,                      // True color RGB with 8 bits per channel.
     
    727727                        static int const aPixmapAttribList[] =
    728728                        {
    729                             GLX_TEXTURE_TARGET_EXT, GLX_TEXTURE_RECTANGLE_EXT /* GLX_TEXTURE_2D_EXT */,
     729                            GLX_TEXTURE_TARGET_EXT, GLX_TEXTURE_2D_EXT,
    730730                            GLX_TEXTURE_FORMAT_EXT, GLX_TEXTURE_FORMAT_RGBA_EXT,
    731731                            None
     
    811811
    812812/* Whether OpenGL is usable.
    813  * OpenGL 2.0 and support for GL_TEXTURE_RECTANGLE is required.
     813 * OpenGL 2.0 required.
    814814 */
    815815/* static */ bool GLWidget::isSupported()
     
    839839
    840840    /* Check if GL_TEXTURE_RECTANGLE is supported: */
    841     bool const fTextureRectangle = contextGL.hasExtension("GL_ARB_texture_rectangle")
    842                                 || contextGL.hasExtension("GL_NV_texture_rectangle")
    843                                 || ver >= 31;
     841    //bool const fTextureRectangle = contextGL.hasExtension("GL_ARB_texture_rectangle")
     842    //                            || contextGL.hasExtension("GL_NV_texture_rectangle")
     843    //                            || ver >= 31;
    844844
    845845    /* Reset the current OpenGL context: */
     
    847847
    848848    /* Decide if OpenGL support is good enough: */
    849     return ver >= 20 && fTextureRectangle;
     849    return ver >= 20 /* && fTextureRectangle */;
    850850}
    851851
     
    986986
    987987        /* The guest coordinates of the visible guest screen area: */
    988         int x1 = m_guestVisibleRect.x();
    989         int y1 = m_guestVisibleRect.y();
    990         int x2 = x1 + m_guestVisibleRect.width();
    991         int y2 = y1 + m_guestVisibleRect.height();
     988        float x1 = m_guestVisibleRect.x();
     989        float y1 = m_guestVisibleRect.y();
     990        float x2 = x1 + m_guestVisibleRect.width();
     991        float y2 = y1 + m_guestVisibleRect.height();
     992
     993        x1 /= (float)m_guestSize.width();
     994        y1 /= (float)m_guestSize.height();
     995        x2 /= (float)m_guestSize.width();
     996        y2 /= (float)m_guestSize.height();
    992997
    993998        glDisable(GL_DEPTH_TEST); GLCHECK();
     
    10041009        /* Draw the texture (upside down, because QImage and OpenGL store the bitmap differently): */
    10051010        glBegin(GL_QUADS);
    1006         glTexCoord2i(x1, y1); glVertex2i(0, h);
    1007         glTexCoord2i(x1, y2); glVertex2i(0, 0);
    1008         glTexCoord2i(x2, y2); glVertex2i(w, 0);
    1009         glTexCoord2i(x2, y1); glVertex2i(w, h);
     1011        glTexCoord2f(x1, y1); glVertex2i(0, h);
     1012        glTexCoord2f(x1, y2); glVertex2i(0, 0);
     1013        glTexCoord2f(x2, y2); glVertex2i(w, 0);
     1014        glTexCoord2f(x2, y1); glVertex2i(w, h);
    10101015        glEnd(); GLCHECK();
    10111016
     
    10411046    /* Create a new guest texture, which must be the same size as the guest screen: */
    10421047    glGenTextures(1, &m_guestTexture);
     1048    glEnable(kTextureTarget); GLCHECK();
    10431049    glBindTexture(kTextureTarget, m_guestTexture);
    10441050    glTexParameteri(kTextureTarget, GL_TEXTURE_MAG_FILTER, filter);
     
    10511057    glBindTexture(kTextureTarget, 0);
    10521058    GLCHECK();
     1059    glDisable(kTextureTarget); GLCHECK();
    10531060}
    10541061
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