Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Has QT QPixmap / QImage / bindTexture limitations that prevent loading / rendering?



  • Hi,

    I try to bind a texture to a GL object, which work for me for several years using:

    environment_textures[1]=bindTexture (QPixmap(QString("../texture/earth4.png")));
    glBindTexture( GL_TEXTURE_2D, environment_textures[1] );
    

    About 1-2 years ago, something with QPixmap / QImage or bindTexture must have changed. All textures still get loaded and redered except one.

    earth4.png is a 8MB picture with a resolution of 7979x3948 pixels. It's the only big image I have.

    I tried to debug the problem, step by step.

    QImage * imagen = new QImage("../texture/earth4.png");
        if(imagen->isNull())
                {
                    cout<<"QImage failed to load earth4"<< endl;
                }
        else cout<<"QImage loaded earth4 successfully"<< endl;
    

    This code will return "QImage loaded earth4 successfully".
    However, the bindTexture normally returns a single digit GLuint. With the earth4.png image, bindTexture returns: 1906110480
    When I change the texture to a smaler image (also png), the texture renders without problem.

    My question: Are there any limitations in QPixmap / QImage or bindTexture that might prevent the loading rendering?


  • Lifetime Qt Champion

    Hi,

    If memory serves well: 32767x32767 pixels however I do not think the issue is from QImage. Did you check GL_MAX_TEXTURE_SIZE ? I suspect it will be smaller that your image.



  • Thanks for the reply. If I understand GL_MAX_TEXTURE_SIZE correctly, it should return the max size of a texture my graphics card supports. However, the texture had already works till ... i guess 2019 or so. On all my systems with very different cards. According to my git repo, I have not change the code responsible for the texture or the rendering. The texture itself was also not modified. I therefore assume that it was a change in the QT code, as I have read somewhere that there has been some development. But I will try to check GL_MAX_TEXTURE_SIZE anyway. Thanks.



  • Ok, I included the following code:

    GLint maxtexsize;
        glGetIntegerv(GL_MAX_TEXTURE_SIZE, &maxtexsize);
        cout<<"Maximum texture size is "<<maxtexsize<<endl;
    

    and it returns:
    Maximum texture size is 16384

    That would mean that my card could handly textures of 16384 x 16384.Should be more than enough. (geforce gtx 1070)


  • Lifetime Qt Champion

    Just to be sure, you changed nothing to your code ?
    If so, did you check the graphics card driver ?



  • I find your last 2 questions confusing. I already wrote that I had not changed the code. And what is that question about the graphics card driver? Why should the driver fail to render on texture but load another? With the same c++ code? As I stated: all other textures load and render fine, except one.
    Any suggestions how I could further debug where the texture code fails?


  • Lifetime Qt Champion

    The question about the driver comes from you writing that the only one failing is the one weighing 8MB. As any other piece of software, drivers can have bugs and regressions. Hence there might be a bug there triggered by the size of your image.



  • Sorry, didn't want to sound angry. As the code runs on different systems with different grafic cards / drivers and always this one texture fails to render, I am just clueless to the reason.


  • Lifetime Qt Champion

    I thought that this image only failed on your system.
    Does it have any other properties beside the size that makes it different from your other images ?
    Would it be possible for you to create a minimal compilable example using it ?


Log in to reply