History

Initial work on rendering in main window, currently broken

ksuprynowicz committed 1 year ago

Commit 1415e2b1 parent 1c1a47a22 files · +535 −63Browse files

Showing the changes to interface/src/Application_Graphics.cpp (1 of 22 files). Show all

Unified · Split

interface/src/Application_Graphics.cpp+10−10
@@ -77,7 +77,7 @@ void Application::initializeGL() { · 76 unmodified lines
77 _isGLInitialized = true;77 _isGLInitialized = true;
78 }78 }
79 79
80 _glWidget->windowHandle()->setFormat(getDefaultOpenGLSurfaceFormat());80 _primaryWidget->windowHandle()->setFormat(getDefaultOpenGLSurfaceFormat()); // VKTODO
81 81
82 // When loading QtWebEngineWidgets, it creates a global share context on startup.82 // When loading QtWebEngineWidgets, it creates a global share context on startup.
83 // We have to account for this possibility by checking here for an existing83 // We have to account for this possibility by checking here for an existing
@@ -118,9 +118,9 @@ void Application::initializeGL() { · 34 unmodified lines
118 }118 }
119#endif119#endif
120 120
121 _glWidget->createContext(globalShareContext);121 _primaryWidget->createContext(globalShareContext);
122 122
123 if (!_glWidget->makeCurrent()) {123 if (!_primaryWidget->makeCurrent()) {
124 qCWarning(interfaceapp, "Unable to make window context current");124 qCWarning(interfaceapp, "Unable to make window context current");
125 }125 }
126 126
@@ -147,7 +147,7 @@ void Application::initializeGL() { · 20 unmodified lines
147#endif147#endif
148 148
149 if (!globalShareContext) {149 if (!globalShareContext) {
150 globalShareContext = _glWidget->qglContext();150 globalShareContext = _primaryWidget->qglContext();
151 qt_gl_set_global_share_context(globalShareContext);151 qt_gl_set_global_share_context(globalShareContext);
152 }152 }
153 153
@@ -162,19 +162,19 @@ void Application::initializeGL() { · 8 unmodified lines
162 }162 }
163 OffscreenQmlSurface::setSharedContext(qmlShareContext->getContext());163 OffscreenQmlSurface::setSharedContext(qmlShareContext->getContext());
164 qmlShareContext->doneCurrent();164 qmlShareContext->doneCurrent();
165 if (!_glWidget->makeCurrent()) {165 if (!_primaryWidget->makeCurrent()) {
166 qCWarning(interfaceapp, "Unable to make window context current");166 qCWarning(interfaceapp, "Unable to make window context current");
167 }167 }
168 }168 }
169#endif169#endif
170 170
171 // Build an offscreen GL context for the main thread.171 // Build an offscreen GL context for the main thread.
172 _glWidget->makeCurrent();172 _primaryWidget->makeCurrent();
173 glClearColor(0.2f, 0.2f, 0.2f, 1);173 glClearColor(0.2f, 0.2f, 0.2f, 1);
174 glClear(GL_COLOR_BUFFER_BIT);174 glClear(GL_COLOR_BUFFER_BIT);
175 _glWidget->swapBuffers();175 _primaryWidget->swapBuffers(); //VKTODO
176 176
177 _graphicsEngine->initializeGPU(_glWidget);177 _graphicsEngine->initializeGPU(_primaryWidget);
178}178}
179 179
180void Application::initializeRenderEngine() {180void Application::initializeRenderEngine() {
@@ -318,7 +318,7 @@ void Application::initializeUi() { · 137 unmodified lines
318 setupPreferences();318 setupPreferences();
319 319
320#if !defined(DISABLE_QML)320#if !defined(DISABLE_QML)
321 _glWidget->installEventFilter(offscreenUi.data());321 _primaryWidget->installEventFilter(offscreenUi.data());
322 offscreenUi->setMouseTranslator([=, this](const QPointF& pt) {322 offscreenUi->setMouseTranslator([=, this](const QPointF& pt) {
323 QPointF result = pt;323 QPointF result = pt;
324 auto displayPlugin = getActiveDisplayPlugin();324 auto displayPlugin = getActiveDisplayPlugin();
@@ -456,7 +456,7 @@ void Application::resizeGL() { · 131 unmodified lines
456}456}
457 457
458glm::uvec2 Application::getCanvasSize() const {458glm::uvec2 Application::getCanvasSize() const {
459 return glm::uvec2(_glWidget->width(), _glWidget->height());459 return glm::uvec2(_primaryWidget->width(), _primaryWidget->height());
460}460}
461 461
462float Application::getRenderResolutionScale() const {462float Application::getRenderResolutionScale() const {