Showing the changes to interface/src/Application.cpp (1 of 14 files). Show all
Unified · Split
| @@ -114,6 +114,8 @@ · 113 unmodified lines | ||
| 114 | 114 | #include "gpu/Batch.h" |
| 115 | 115 | #include "gpu/GLBackend.h" |
| 116 | 116 | |
| 117 | +#include "plugins/render/RenderPlugin.h" | |
| 118 | + | |
| 117 | 119 | #include "scripting/AccountScriptingInterface.h" |
| 118 | 120 | #include "scripting/AudioDeviceScriptingInterface.h" |
| 119 | 121 | #include "scripting/ClipboardScriptingInterface.h" |
| @@ -584,7 +586,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) : · 464 unmodified lines | ||
| 584 | 586 | this->installEventFilter(this); |
| 585 | 587 | // The offscreen UI needs to intercept the mouse and keyboard |
| 586 | 588 | // events coming from the onscreen window |
| 587 | − _glWidget->installEventFilter(DependencyManager::get<OffscreenUi>().data()); | |
| 589 | + //_glWidget->installEventFilter(DependencyManager::get<OffscreenUi>().data()); | |
| 588 | 590 | } |
| 589 | 591 | |
| 590 | 592 | |
| @@ -726,7 +728,7 @@ void Application::initializeGL() { · 135 unmodified lines | ||
| 726 | 728 | // texture resources |
| 727 | 729 | initializeUi(); |
| 728 | 730 | qCDebug(interfaceapp, "Initialized Offscreen UI."); |
| 729 | − _glWidget->makeCurrent(); | |
| 731 | + _offscreenContext->makeCurrent(); | |
| 730 | 732 | |
| 731 | 733 | // call Menu getInstance static method to set up the menu |
| 732 | 734 | // Needs to happen AFTER the QML UI initialization |
| @@ -770,30 +772,24 @@ void Application::initializeUi() { · 37 unmodified lines | ||
| 770 | 772 | VrMenu::registerType(); |
| 771 | 773 | |
| 772 | 774 | auto offscreenUi = DependencyManager::get<OffscreenUi>(); |
| 773 | − offscreenUi->create(_glWidget->context()->contextHandle()); | |
| 774 | − offscreenUi->resize(_glWidget->size()); | |
| 775 | + offscreenUi->create(_offscreenContext->getContext()); | |
| 776 | + offscreenUi->resize(fromGlm(getActiveRenderPlugin()->getCanvasSize())); | |
| 775 | 777 | offscreenUi->setProxyWindow(_window->windowHandle()); |
| 776 | 778 | offscreenUi->setBaseUrl(QUrl::fromLocalFile(PathUtils::resourcesPath() + "/qml/")); |
| 777 | 779 | offscreenUi->load("Root.qml"); |
| 778 | 780 | offscreenUi->load("RootMenu.qml"); |
| 779 | 781 | VrMenu::load(); |
| 780 | 782 | VrMenu::executeQueuedLambdas(); |
| 781 | − offscreenUi->setMouseTranslator([this](const QPointF& p){ | |
| 782 | − if (OculusManager::isConnected()) { | |
| 783 | − glm::vec2 pos = _applicationOverlay.screenToOverlay(toGlm(p)); | |
| 784 | − return QPointF(pos.x, pos.y); | |
| 785 | − } | |
| 786 | − return QPointF(p); | |
| 787 | − }); | |
| 783 | + offscreenUi->setMouseTranslator(getActiveRenderPlugin()->getMouseTranslator()); | |
| 788 | 784 | offscreenUi->resume(); |
| 789 | 785 | connect(_window, &MainWindow::windowGeometryChanged, [this](const QRect & r){ |
| 790 | 786 | static qreal oldDevicePixelRatio = 0; |
| 791 | − qreal devicePixelRatio = _glWidget->devicePixelRatio(); | |
| 787 | + qreal devicePixelRatio = getActiveRenderPlugin()->devicePixelRatio(); | |
| 792 | 788 | if (devicePixelRatio != oldDevicePixelRatio) { |
| 793 | 789 | oldDevicePixelRatio = devicePixelRatio; |
| 794 | 790 | qDebug() << "Device pixel ratio changed, triggering GL resize"; |
| 795 | − resizeGL(_glWidget->width(), | |
| 796 | − _glWidget->height()); | |
| 791 | + auto canvasSize = getActiveRenderPlugin()->getCanvasSize(); | |
| 792 | + resizeGL(canvasSize.x, canvasSize.y); | |
| 797 | 793 | } |
| 798 | 794 | }); |
| 799 | 795 | } |
| @@ -846,8 +842,9 @@ void Application::paintGL() { · 46 unmodified lines | ||
| 846 | 842 | DependencyManager::get<GlowEffect>()->prepare(); |
| 847 | 843 | |
| 848 | 844 | // Primary rendering pass |
| 849 | − auto primaryFbo = DependencyManager::get<TextureCache>()->getPrimaryFramebufferObject(); | |
| 850 | − primaryFbo->bind(); | |
| 845 | + auto primaryFbo = DependencyManager::get<TextureCache>()->getPrimaryFramebuffer(); | |
| 846 | + auto finalFbo = primaryFbo; | |
| 847 | + glBindFramebuffer(GL_FRAMEBUFFER, gpu::GLBackend::getFramebufferID(primaryFbo)); | |
| 851 | 848 | { |
| 852 | 849 | glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); |
| 853 | 850 | |
| @@ -864,32 +861,18 @@ void Application::paintGL() { · 10 unmodified lines | ||
| 864 | 861 | if (Menu::getInstance()->isOptionChecked(MenuOption::FullscreenMirror)) { |
| 865 | 862 | _rearMirrorTools->render(true); |
| 866 | 863 | } else if (Menu::getInstance()->isOptionChecked(MenuOption::Mirror)) { |
| 867 | −<<<<<<< HEAD | |
| 868 | 864 | renderRearViewMirror(_mirrorViewRect); |
| 869 | −======= | |
| 870 | − renderRearViewMirror(_mirrorViewRect); | |
| 871 | 865 | } |
| 872 | 866 | |
| 873 | − DependencyManager::get<GlowEffect>()->render(); | |
| 874 | − | |
| 867 | + finalFbo = DependencyManager::get<GlowEffect>()->render(); | |
| 875 | 868 | { |
| 876 | 869 | PerformanceTimer perfTimer("renderOverlay"); |
| 877 | 870 | _applicationOverlay.renderOverlay(); |
| 871 | + glBindFramebuffer(GL_FRAMEBUFFER, gpu::GLBackend::getFramebufferID(finalFbo)); | |
| 878 | 872 | _applicationOverlay.displayOverlayTexture(); |
| 879 | −>>>>>>> master | |
| 873 | + glBindFramebuffer(GL_FRAMEBUFFER, 0); | |
| 880 | 874 | } |
| 881 | 875 | } |
| 882 | − primaryFbo->release(); | |
| 883 | − | |
| 884 | − QOpenGLFramebufferObject * finalFbo = DependencyManager::get<GlowEffect>()->render(); | |
| 885 | − | |
| 886 | − finalFbo->bind(); | |
| 887 | − { | |
| 888 | − PerformanceTimer perfTimer("renderOverlay"); | |
| 889 | − _applicationOverlay.renderOverlay(); | |
| 890 | − _applicationOverlay.displayOverlayTexture(); | |
| 891 | − } | |
| 892 | − finalFbo->release(); | |
| 893 | 876 | |
| 894 | 877 | // This might not be needed *right now*. We want to ensure that the FBO rendering |
| 895 | 878 | // has completed before we start trying to read from it in another context. However |
| @@ -899,7 +882,7 @@ void Application::paintGL() { · 3 unmodified lines | ||
| 899 | 882 | |
| 900 | 883 | _offscreenContext->doneCurrent(); |
| 901 | 884 | Q_ASSERT(!QOpenGLContext::currentContext()); |
| 902 | − getActiveRenderPlugin()->render(finalFbo->texture()); | |
| 885 | + getActiveRenderPlugin()->render(gpu::GLBackend::getTextureID(finalFbo->getRenderBuffer(0))); | |
| 903 | 886 | Q_ASSERT(!QOpenGLContext::currentContext()); |
| 904 | 887 | _offscreenContext->makeCurrent(); |
| 905 | 888 | _frameCount++; |
| @@ -951,8 +934,9 @@ void Application::resizeGL(int width, int height) { · 45 unmodified lines | ||
| 951 | 934 | updateProjectionMatrix(); |
| 952 | 935 | glLoadIdentity(); |
| 953 | 936 | |
| 937 | + auto canvasSize = getActiveRenderPlugin()->getCanvasSize(); | |
| 954 | 938 | auto offscreenUi = DependencyManager::get<OffscreenUi>(); |
| 955 | − offscreenUi->resize(_glWidget->size()); | |
| 939 | + offscreenUi->resize(fromGlm(canvasSize)); | |
| 956 | 940 | |
| 957 | 941 | // update Stats width |
| 958 | 942 | // let's set horizontal offset to give stats some margin to mirror |
| @@ -1003,43 +987,6 @@ bool Application::importSVOFromURL(const QString& urlString) { · 44 unmodified lines | ||
| 1003 | 987 | |
| 1004 | 988 | bool Application::event(QEvent* event) { |
| 1005 | 989 | switch (event->type()) { |
| 1006 | −<<<<<<< HEAD | |
| 1007 | − case QEvent::MouseMove: | |
| 1008 | − mouseMoveEvent((QMouseEvent*)event); | |
| 1009 | − return true; | |
| 1010 | − | |
| 1011 | − case QEvent::MouseButtonPress: | |
| 1012 | − mousePressEvent((QMouseEvent*)event); | |
| 1013 | − return true; | |
| 1014 | − | |
| 1015 | − case QEvent::MouseButtonRelease: | |
| 1016 | − mouseReleaseEvent((QMouseEvent*)event); | |
| 1017 | − return true; | |
| 1018 | − | |
| 1019 | − case QEvent::KeyPress: | |
| 1020 | − keyPressEvent((QKeyEvent*)event); | |
| 1021 | − return true; | |
| 1022 | − | |
| 1023 | − case QEvent::KeyRelease: | |
| 1024 | − keyReleaseEvent((QKeyEvent*)event); | |
| 1025 | − return true; | |
| 1026 | − | |
| 1027 | − case QEvent::FocusIn: | |
| 1028 | − //focusInEvent((QFocusEvent*)event); | |
| 1029 | − //return true; | |
| 1030 | − break; | |
| 1031 | − | |
| 1032 | − case QEvent::FocusOut: | |
| 1033 | − focusOutEvent((QFocusEvent*)event); | |
| 1034 | − return true; | |
| 1035 | − | |
| 1036 | − case QEvent::Resize: | |
| 1037 | − resizeEvent((QResizeEvent *)event); | |
| 1038 | − return true; | |
| 1039 | − | |
| 1040 | − default: | |
| 1041 | − break; | |
| 1042 | −======= | |
| 1043 | 990 | case Lambda: |
| 1044 | 991 | ((LambdaEvent*)event)->call(); |
| 1045 | 992 | return true; |
| @@ -1080,7 +1027,6 @@ bool Application::event(QEvent* event) { · 34 unmodified lines | ||
| 1080 | 1027 | return true; |
| 1081 | 1028 | default: |
| 1082 | 1029 | break; |
| 1083 | −>>>>>>> master | |
| 1084 | 1030 | } |
| 1085 | 1031 | |
| 1086 | 1032 | // handle custom URL |
| @@ -2990,13 +2936,7 @@ void Application::updateShadowMap() { · 1903 unmodified lines | ||
| 2990 | 2936 | glMatrixMode(GL_MODELVIEW); |
| 2991 | 2937 | } |
| 2992 | 2938 | |
| 2993 | −<<<<<<< HEAD | |
| 2994 | − fbo->release(); | |
| 2995 | −======= | |
| 2996 | − // fbo->release(); | |
| 2997 | − | |
| 2998 | − glViewport(0, 0, _glWidget->getDeviceWidth(), _glWidget->getDeviceHeight()); | |
| 2999 | −>>>>>>> master | |
| 2939 | +// glViewport(0, 0, _glWidget->getDeviceWidth(), _glWidget->getDeviceHeight()); | |
| 3000 | 2940 | activeRenderingThread = nullptr; |
| 3001 | 2941 | } |
| 3002 | 2942 | |