Important: Please read the Qt Code of Conduct -

Multitexturing problem

  • Hi to everyone,
    I am struggling findind the right procedure for multitexturing in QT, i just would like to be able to load more than one texture for my shader. Should I use the shaderProgam.bindAttributeLocation. I know the theory, that each texture should be placed in a specific block of memory. I even know the procedure on a normal openGl program, but some of the function I am supposed to use are under QGLFunctions::... I know the Qt might manage things differently, so if you have a link or something to look at.
    Thank you in advance.

    Maurizio Di Vitto

  • Moderators

    First of all QGLFunctions is deprecated.
    You should be using "QOpenGLFunctions":QOpenGLFunctions or more specifically a subclass for the OpenGL version you want to use, like "QOpenGLFunctions_4_3_Core":

    What do you mean Qt handles things differently? The QOpenGLFunction_... classes give you pointers to raw OpenGL functions. You do everything as without Qt (apart Qt specific stuff like using QImage as a texture).

    You can do multitexturing in any of the usual ways. The older style: glActiveTexture and glEnable or, if you're using the newer, bindless version: glBindMultiTextureEXT.
    Then you bind shader samplers to specific slots with glUniform or use layout(binding=) specifier in your shaders.

  • Thank you for your advices.

Log in to reply