Beispiel #1
0
void MacQml::init() {
    Parent::init();
    _glf.glGenFramebuffers(1, &_fbo);
    _surface.reset(new hifi::qml::OffscreenSurface());
    //QUrl url =getTestResource("qml/main.qml");
    QUrl url = getTestResource("qml/MacQml.qml");
    hifi::qml::QmlContextObjectCallback callback =[](QQmlContext* context, QQuickItem* item) {
    };
    _surface->load(url, callback);
    _surface->resize(_window->size());
    _surface->resume();

}
Beispiel #2
0
void TestWindow::buildSurface(QmlInfo& qmlInfo, bool video) {
    ++_surfaceCount;
    auto lifetimeSecs = (uint32_t)(5.0f + (randFloat() * 10.0f));
    auto lifetimeUsecs = (USECS_PER_SECOND * lifetimeSecs);
    qmlInfo.lifetime = lifetimeUsecs + usecTimestampNow();
    qmlInfo.texture = 0;
    qmlInfo.surface.reset(new hifi::qml::OffscreenSurface());
    qmlInfo.surface->load(getTestResource(CONTROL_URL), [video](QQmlContext* context, QQuickItem* item) {
        item->setProperty(URL_PROPERTY, getSourceUrl(video));
    });
    qmlInfo.surface->setMaxFps(DEFAULT_MAX_FPS);
    qmlInfo.surface->resize(_qmlSize);
    qmlInfo.surface->resume();
}