mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-25 16:55:07 +02:00
Restore GL context information to the QML context
This commit is contained in:
parent
afbbd398dc
commit
caf7d87841
2 changed files with 5 additions and 17 deletions
|
@ -116,21 +116,6 @@ QNetworkAccessManager* QmlNetworkAccessManagerFactory::create(QObject* parent) {
|
|||
Q_DECLARE_LOGGING_CATEGORY(offscreenFocus)
|
||||
Q_LOGGING_CATEGORY(offscreenFocus, "hifi.offscreen.focus")
|
||||
|
||||
#if 0
|
||||
QJsonObject getGLContextData();
|
||||
QJsonObject _glData;
|
||||
|
||||
QJsonObject OffscreenQmlSurface::getGLContextData() {
|
||||
_glMutex.lock();
|
||||
if (_glData.isEmpty()) {
|
||||
_glWait.wait(&_glMutex);
|
||||
}
|
||||
_glMutex.unlock();
|
||||
return _glData;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
void OffscreenQmlSurface::setupFbo() {
|
||||
_canvas->makeCurrent();
|
||||
_textures.setSize(_size);
|
||||
|
@ -324,7 +309,7 @@ void OffscreenQmlSurface::create(QOpenGLContext* shareContext) {
|
|||
}
|
||||
|
||||
// FIXME
|
||||
// _qmlEngine->rootContext()->setContextProperty("GL", _renderer->getGLContextData());
|
||||
_qmlEngine->rootContext()->setContextProperty("GL", _glData);
|
||||
_qmlEngine->rootContext()->setContextProperty("offscreenWindow", QVariant::fromValue(getWindow()));
|
||||
_qmlComponent = new QQmlComponent(_qmlEngine);
|
||||
|
||||
|
@ -336,6 +321,7 @@ void OffscreenQmlSurface::create(QOpenGLContext* shareContext) {
|
|||
qWarning("Failed to make context current for QML Renderer");
|
||||
return;
|
||||
}
|
||||
_glData = ::getGLContextData();
|
||||
_renderControl->initialize(_canvas->getContext());
|
||||
setupFbo();
|
||||
|
||||
|
|
|
@ -98,8 +98,8 @@ private:
|
|||
void setupFbo();
|
||||
bool allowNewFrame(uint8_t fps);
|
||||
void render();
|
||||
void resize();
|
||||
void cleanup();
|
||||
QJsonObject getGLContextData();
|
||||
|
||||
private slots:
|
||||
void updateQuick();
|
||||
|
@ -112,6 +112,8 @@ private:
|
|||
QQmlComponent* _qmlComponent { nullptr };
|
||||
QQuickItem* _rootItem { nullptr };
|
||||
OffscreenGLCanvas* _canvas { nullptr };
|
||||
QJsonObject _glData;
|
||||
|
||||
QTimer _updateTimer;
|
||||
uint32_t _fbo { 0 };
|
||||
uint32_t _depthStencil { 0 };
|
||||
|
|
Loading…
Reference in a new issue