c++ – Is there a way to render a 2D texture using DirectX in QML

I need to write an application in C++ QML that will render textures using DirectX. I looked at examples from Qt, but didn’t find anything.

I tried to do smth like that

const D3D11_TEXTURE2D_DESC desc{
        256, 256, 1, 1, DXGI_FORMAT_R8G8B8A8_UNORM, {1, 0}, D3D11_USAGE_DEFAULT, D3D11_BIND_SHADER_RESOURCE
    };


    auto tex_hr = m_device->CreateTexture2D(&desc, &resourceData, &m_texture);

    if (FAILED(tex_hr)) {
        qFatal("Failed to create texture: 0x%x", tex_hr);
    }
    else {
        qDebug("Texture was created!");
    }

but I can’t understand how to load a texture from a file and show it in QML

Read more here: Source link