Search code examples
c++qttextures

Image as texture in QT


I'm having problems with a custom item in QT because i want to map a texture in a geometry using updatePaintNode, What should I do to load an image as a Texture in a sceneGraph in QT in the updatePaintNode method? please help me with an example, i've been searching for examples but all I found were very confusing stuff.


Solution

  • The easiest way to get the texture, it is using QQuickWindow::​createTextureFromImage function.

    Another way is subclassing QSGTexture and implement your custom binding function. For detail see QSGPlainTexture source code.