Jump to content

QML integration with several Unigine items


photo

Recommended Posts

Hello. I’m trying to integrate Unigine in my QML application and found some problems with it.

I don`t understand how to add more than one Unigine Item in QML, although I have a close look at QT integration examples from UNIGINE SDK. The solution should be like in Viewport Qt from your samples in terms of several Unigine frames. Is it possible to implement this? If yes, how can I achieve this, if not, what would you suggest?

I`m using your QML sample as a base for UNIGINE-QML integration.


Examples of QML pseudocode how I would like to use Unigine in my application:

 

1. More preferable

ApplicationWindow {

    id: mainWindow

    UnigineItem {
        id: unigineItem1
        source: model1.node
        x: 5
        y: 5
        width: 200
        height: 200
    }

    UnigineItem {
        id: unigineItem2
        source: model2.node
        x: 220
        y: 5
        width: 200
        height: 200
    }

    Text{
       text: "Some text!"
            x: 5
            y: 230
    }
}

 

2. Less preferable, but acceptable

ApplicationWindow {

    id: mainWindow

    Window {
        id: unigineWindow1
        UnigineItem {
            id: unigineItem1
            source: model1.node
            x: 5
            y: 5
            width: 200
            height: 200
        }
    }



    Window {
        id: unigineWindow2

        UnigineItem {
            id: unigineItem2
            source: model2.node
            x: 220
            y: 5
            width: 200
            height: 200
        }
    }


    Text{
       text: "Some text!"
            x: 5
            y: 230
    }
}

 

Edited by tolchinski.alexei
Link to comment

Hi Alexei,

Qml sample isn't suitable for your case since "UnigineItem" was implemented as a kind of singleton - it initializes "Unigine::Engine/App"
and manages the entire Engine's lifecycle under the hood.

I guess you are right about ViewportQt sample - it is more applicable. You have to separate Engine's initialization and lifecycle management
from widgets code. UnigineItem's logic should look like ViewportWidgetQt with its own "Unigine::Viewport/RenderContext/Player" instances.
Also, take a look into PlatformRender class from the same sample - it is convenient wrapper over  "Unigine::RenderContext".

  • Like 1
Link to comment
×
×
  • Create New...