History

Working on merging in master

Brad Davis committed 11 years ago

Commit ba4ae371 parent 031b29414 files · +111 −119Browse files

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

Unified · Split

interface/src/Application.cpp+20−80
@@ -114,6 +114,8 @@ · 113 unmodified lines
114#include "gpu/Batch.h"114#include "gpu/Batch.h"
115#include "gpu/GLBackend.h"115#include "gpu/GLBackend.h"
116 116
117#include "plugins/render/RenderPlugin.h"
118
117#include "scripting/AccountScriptingInterface.h"119#include "scripting/AccountScriptingInterface.h"
118#include "scripting/AudioDeviceScriptingInterface.h"120#include "scripting/AudioDeviceScriptingInterface.h"
119#include "scripting/ClipboardScriptingInterface.h"121#include "scripting/ClipboardScriptingInterface.h"
@@ -584,7 +586,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) : · 464 unmodified lines
584 this->installEventFilter(this);586 this->installEventFilter(this);
585 // The offscreen UI needs to intercept the mouse and keyboard 587 // The offscreen UI needs to intercept the mouse and keyboard
586 // events coming from the onscreen window588 // 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 // texture resources728 // texture resources
727 initializeUi();729 initializeUi();
728 qCDebug(interfaceapp, "Initialized Offscreen UI.");730 qCDebug(interfaceapp, "Initialized Offscreen UI.");
729 _glWidget->makeCurrent();731 _offscreenContext->makeCurrent();
730 732
731 // call Menu getInstance static method to set up the menu733 // call Menu getInstance static method to set up the menu
732 // Needs to happen AFTER the QML UI initialization734 // Needs to happen AFTER the QML UI initialization
@@ -770,30 +772,24 @@ void Application::initializeUi() { · 37 unmodified lines
770 VrMenu::registerType();772 VrMenu::registerType();
771 773
772 auto offscreenUi = DependencyManager::get<OffscreenUi>();774 auto offscreenUi = DependencyManager::get<OffscreenUi>();
773 offscreenUi->create(_glWidget->context()->contextHandle());775 offscreenUi->create(_offscreenContext->getContext());
774 offscreenUi->resize(_glWidget->size());776 offscreenUi->resize(fromGlm(getActiveRenderPlugin()->getCanvasSize()));
775 offscreenUi->setProxyWindow(_window->windowHandle());777 offscreenUi->setProxyWindow(_window->windowHandle());
776 offscreenUi->setBaseUrl(QUrl::fromLocalFile(PathUtils::resourcesPath() + "/qml/"));778 offscreenUi->setBaseUrl(QUrl::fromLocalFile(PathUtils::resourcesPath() + "/qml/"));
777 offscreenUi->load("Root.qml");779 offscreenUi->load("Root.qml");
778 offscreenUi->load("RootMenu.qml");780 offscreenUi->load("RootMenu.qml");
779 VrMenu::load();781 VrMenu::load();
780 VrMenu::executeQueuedLambdas();782 VrMenu::executeQueuedLambdas();
781 offscreenUi->setMouseTranslator([this](const QPointF& p){783 offscreenUi->setMouseTranslator(getActiveRenderPlugin()->getMouseTranslator());
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 });
788 offscreenUi->resume();784 offscreenUi->resume();
789 connect(_window, &MainWindow::windowGeometryChanged, [this](const QRect & r){785 connect(_window, &MainWindow::windowGeometryChanged, [this](const QRect & r){
790 static qreal oldDevicePixelRatio = 0;786 static qreal oldDevicePixelRatio = 0;
791 qreal devicePixelRatio = _glWidget->devicePixelRatio();787 qreal devicePixelRatio = getActiveRenderPlugin()->devicePixelRatio();
792 if (devicePixelRatio != oldDevicePixelRatio) {788 if (devicePixelRatio != oldDevicePixelRatio) {
793 oldDevicePixelRatio = devicePixelRatio;789 oldDevicePixelRatio = devicePixelRatio;
794 qDebug() << "Device pixel ratio changed, triggering GL resize";790 qDebug() << "Device pixel ratio changed, triggering GL resize";
795 resizeGL(_glWidget->width(),791 auto canvasSize = getActiveRenderPlugin()->getCanvasSize();
796 _glWidget->height());792 resizeGL(canvasSize.x, canvasSize.y);
797 }793 }
798 });794 });
799}795}
@@ -846,8 +842,9 @@ void Application::paintGL() { · 46 unmodified lines
846 DependencyManager::get<GlowEffect>()->prepare();842 DependencyManager::get<GlowEffect>()->prepare();
847 843
848 // Primary rendering pass844 // Primary rendering pass
849 auto primaryFbo = DependencyManager::get<TextureCache>()->getPrimaryFramebufferObject();845 auto primaryFbo = DependencyManager::get<TextureCache>()->getPrimaryFramebuffer();
850 primaryFbo->bind();846 auto finalFbo = primaryFbo;
847 glBindFramebuffer(GL_FRAMEBUFFER, gpu::GLBackend::getFramebufferID(primaryFbo));
851 {848 {
852 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);849 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
853 850
@@ -864,32 +861,18 @@ void Application::paintGL() { · 10 unmodified lines
864 if (Menu::getInstance()->isOptionChecked(MenuOption::FullscreenMirror)) {861 if (Menu::getInstance()->isOptionChecked(MenuOption::FullscreenMirror)) {
865 _rearMirrorTools->render(true);862 _rearMirrorTools->render(true);
866 } else if (Menu::getInstance()->isOptionChecked(MenuOption::Mirror)) {863 } else if (Menu::getInstance()->isOptionChecked(MenuOption::Mirror)) {
867<<<<<<< HEAD
868 renderRearViewMirror(_mirrorViewRect);864 renderRearViewMirror(_mirrorViewRect);
869=======
870 renderRearViewMirror(_mirrorViewRect);
871 }865 }
872 866
873 DependencyManager::get<GlowEffect>()->render();867 finalFbo = DependencyManager::get<GlowEffect>()->render();
874
875 {868 {
876 PerformanceTimer perfTimer("renderOverlay");869 PerformanceTimer perfTimer("renderOverlay");
877 _applicationOverlay.renderOverlay();870 _applicationOverlay.renderOverlay();
871 glBindFramebuffer(GL_FRAMEBUFFER, gpu::GLBackend::getFramebufferID(finalFbo));
878 _applicationOverlay.displayOverlayTexture();872 _applicationOverlay.displayOverlayTexture();
879>>>>>>> master873 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 // This might not be needed *right now*. We want to ensure that the FBO rendering877 // This might not be needed *right now*. We want to ensure that the FBO rendering
895 // has completed before we start trying to read from it in another context. However878 // 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 _offscreenContext->doneCurrent();883 _offscreenContext->doneCurrent();
901 Q_ASSERT(!QOpenGLContext::currentContext());884 Q_ASSERT(!QOpenGLContext::currentContext());
902 getActiveRenderPlugin()->render(finalFbo->texture());885 getActiveRenderPlugin()->render(gpu::GLBackend::getTextureID(finalFbo->getRenderBuffer(0)));
903 Q_ASSERT(!QOpenGLContext::currentContext());886 Q_ASSERT(!QOpenGLContext::currentContext());
904 _offscreenContext->makeCurrent();887 _offscreenContext->makeCurrent();
905 _frameCount++;888 _frameCount++;
@@ -951,8 +934,9 @@ void Application::resizeGL(int width, int height) { · 45 unmodified lines
951 updateProjectionMatrix();934 updateProjectionMatrix();
952 glLoadIdentity();935 glLoadIdentity();
953 936
937 auto canvasSize = getActiveRenderPlugin()->getCanvasSize();
954 auto offscreenUi = DependencyManager::get<OffscreenUi>();938 auto offscreenUi = DependencyManager::get<OffscreenUi>();
955 offscreenUi->resize(_glWidget->size());939 offscreenUi->resize(fromGlm(canvasSize));
956 940
957 // update Stats width941 // update Stats width
958 // let's set horizontal offset to give stats some margin to mirror942 // 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
1004bool Application::event(QEvent* event) {988bool Application::event(QEvent* event) {
1005 switch (event->type()) {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 case Lambda:990 case Lambda:
1044 ((LambdaEvent*)event)->call();991 ((LambdaEvent*)event)->call();
1045 return true;992 return true;
@@ -1080,7 +1027,6 @@ bool Application::event(QEvent* event) { · 34 unmodified lines
1080 return true;1027 return true;
1081 default:1028 default:
1082 break;1029 break;
1083>>>>>>> master
1084 }1030 }
1085 1031
1086 // handle custom URL1032 // handle custom URL
@@ -2990,13 +2936,7 @@ void Application::updateShadowMap() { · 1903 unmodified lines
2990 glMatrixMode(GL_MODELVIEW);2936 glMatrixMode(GL_MODELVIEW);
2991 }2937 }
2992 2938
2993<<<<<<< HEAD2939// glViewport(0, 0, _glWidget->getDeviceWidth(), _glWidget->getDeviceHeight());
2994 fbo->release();
2995=======
2996 // fbo->release();
2997
2998 glViewport(0, 0, _glWidget->getDeviceWidth(), _glWidget->getDeviceHeight());
2999>>>>>>> master
3000 activeRenderingThread = nullptr;2940 activeRenderingThread = nullptr;
3001}2941}
3002 2942