Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QOpenGLTexture encounters GL_OUT_OF_MEMORY

QOpenGLTexture encounters GL_OUT_OF_MEMORY

Scheduled Pinned Locked Moved Solved General and Desktop
4 Posts 2 Posters 317 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    dalishi
    wrote on 14 Jul 2022, 15:30 last edited by dalishi
    #1

    Hi, i'm not sure this is a Qt issue or pure OpenGL issue. I'm using the following in Qt5.15.2 on Ubuntu 20 to load an image as a texure in QOpenGLWidget.

    if (m_image.load(filename)) {
            m_texture = new QOpenGLTexture(m_image.mirrored());
            CheckGLError(419); // 419 is just line number
    

    Im able to load a small size image (e.g. 500k) successfully. But loading larger image (~50M) as txture will encounter the following error:

    GL Error at Line 419: GL_OUT_OF_MEMORY
    

    My PC has a Nvidia 1080 graphics card with 8G memory. How come it is out of memory for a 50M size image?

    My glxinfo lists:

    name of display: :0
    display: :0  screen: 0
    direct rendering: Yes
    Extended renderer info (GLX_MESA_query_renderer):
        Vendor: nouveau (0x10de)
        Device: NV134 (0x1b80)
        Version: 21.2.6
        Accelerated: yes
        Video memory: 8173MB
        Unified memory: no
        Preferred profile: core (0x1)
        Max core profile version: 4.3
        Max compat profile version: 4.3
        Max GLES1 profile version: 1.1
        Max GLES[23] profile version: 3.2
    OpenGL vendor string: nouveau
    OpenGL renderer string: NV134
    OpenGL core profile version string: 4.3 (Core Profile) Mesa 21.2.6
    OpenGL core profile shading language version string: 4.30
    OpenGL core profile context flags: (none)
    OpenGL core profile profile mask: core profile
    
    OpenGL version string: 4.3 (Compatibility Profile) Mesa 21.2.6
    OpenGL shading language version string: 4.30
    OpenGL context flags: (none)
    OpenGL profile mask: compatibility profile
    
    OpenGL ES profile version string: OpenGL ES 3.2 Mesa 21.2.6
    OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.20
    
    1 Reply Last reply
    0
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 14 Jul 2022, 16:35 last edited by
      #2

      Hi,

      What kind of image are you loading ?
      What is its size ?
      Which format are you using for the texture ?
      Do you have other textures ?

      The fact that it already weighs 50M hints that it's quite large. It also likely uses some form or another of compression which means that the uncompressed version will be pretty large.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      D 1 Reply Last reply 15 Jul 2022, 03:29
      0
      • S SGaist
        14 Jul 2022, 16:35

        Hi,

        What kind of image are you loading ?
        What is its size ?
        Which format are you using for the texture ?
        Do you have other textures ?

        The fact that it already weighs 50M hints that it's quite large. It also likely uses some form or another of compression which means that the uncompressed version will be pretty large.

        D Offline
        D Offline
        dalishi
        wrote on 15 Jul 2022, 03:29 last edited by dalishi
        #3

        @SGaist Hi it is a PNG file, 42.9MB (dimension 15000X15000), I can open it with apps like windows photo viewer.

        I'm not sure what exactly the format it is using, im just using this code to load this image and draw

        if (m_image.load(filename)) {
                m_texture = new QOpenGLTexture(m_image.mirrored());
        ....
                m_texture->bind();
                glDrawArrays(GL_TRIANGLE_FAN, 0, 4); 
        

        I have only this one texture as a background view for my app. But I did try to load other smaller images, and it is quite OK. Check this screenshot when I load a 1M size Iron man wallpaper as texture.

        Screenshot from 2022-07-15 11-17-52.png

        Weird thing is previously my app was built with Qt5.12 on Ubuntu16 with integrated intel card running lower version mesa driver, this big texture image was successfully loaded and shown. I encountered this out of memory issue actually after I upgraded to Qt5.15 on Ubuntu20 with Nvidia card running nouveau driver. I did not change any code during the upgrade except one GLSL shader function (texture2D() changed to texture(), I think texture2D is for old GLSL and deprecated). So im still guessing it is related to the new graphics driver or OpenGL.

        1 Reply Last reply
        0
        • D Offline
          D Offline
          dalishi
          wrote on 15 Jul 2022, 09:38 last edited by
          #4

          The error disappeared after I switched from Nouveau to Nvidia proprietary driver.

          1 Reply Last reply
          0

          1/4

          14 Jul 2022, 15:30

          • Login

          • Login or register to search.
          1 out of 4
          • First post
            1/4
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved