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

calling glCopyTexImage2D on QOpenGLTexture raises "immutable" error



  • I'm trying to migrate my application to use QOpenGLTexture classes to abstract away a lot of the texture logic. All the normal binds seem to work as intended except where I try copying from an FBO back in to one of the textures using glCopyTexImage2D.

    I get the following debug error when copying:

    QOpenGLDebugMessage("APISource", 1282, "GL_INVALID_OPERATION error generated. Texture is immutable.", "HighSeverity", "ErrorType")
    

    This is what I was doing previously:

        glBindTexture(GL_TEXTURE_2D, TextureCache::meshTextureId(mesh));
        glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 0, 0, TARGET_TEXTURE_SIZE, TARGET_TEXTURE_SIZE, 0);
    

    And this is what I'm doing now:

        meshTexture->bind();
        glCopyTexImage2D(meshTexture->target(), 0, meshTexture->format(), 0, 0, TARGET_TEXTURE_SIZE, TARGET_TEXTURE_SIZE, 0);
    

    Reading up on QOpenGLTexture, it tries to use immutable storage where possible, which should still allow me to write to it as long as I don't change format or texture size.

    Any thoughts on why this glCopyTexImage2D command is now failing?


Log in to reply