Showing the changes to interface/src/Application.cpp (1 of 13 files). Show all
Unified · Split
| @@ -807,8 +807,7 @@ void Application::initializeUi() { · 806 unmodified lines | ||
| 807 | 807 | if (devicePixelRatio != oldDevicePixelRatio) { |
| 808 | 808 | oldDevicePixelRatio = devicePixelRatio; |
| 809 | 809 | qDebug() << "Device pixel ratio changed, triggering GL resize"; |
| 810 | − resizeGL(_glWidget->width(), | |
| 811 | − _glWidget->height()); | |
| 810 | + resizeGL(); | |
| 812 | 811 | } |
| 813 | 812 | }); |
| 814 | 813 | } |
| @@ -825,15 +824,7 @@ void Application::paintGL() { · 10 unmodified lines | ||
| 825 | 824 | PerformanceWarning::setSuppressShortTimings(Menu::getInstance()->isOptionChecked(MenuOption::SuppressShortTimings)); |
| 826 | 825 | bool showWarnings = Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings); |
| 827 | 826 | PerformanceWarning warn(showWarnings, "Application::paintGL()"); |
| 828 | − | |
| 829 | − // Set the desired FBO texture size. If it hasn't changed, this does nothing. | |
| 830 | − // Otherwise, it must rebuild the FBOs | |
| 831 | − if (OculusManager::isConnected()) { | |
| 832 | − DependencyManager::get<TextureCache>()->setFrameBufferSize(OculusManager::getRenderTargetSize()); | |
| 833 | − } else { | |
| 834 | − QSize fbSize = _glWidget->getDeviceSize() * getRenderResolutionScale(); | |
| 835 | − DependencyManager::get<TextureCache>()->setFrameBufferSize(fbSize); | |
| 836 | − } | |
| 827 | + resizeGL(); | |
| 837 | 828 | |
| 838 | 829 | glEnable(GL_LINE_SMOOTH); |
| 839 | 830 | |
| @@ -910,7 +901,14 @@ void Application::paintGL() { · 70 unmodified lines | ||
| 910 | 901 | renderRearViewMirror(_mirrorViewRect); |
| 911 | 902 | } |
| 912 | 903 | |
| 913 | − DependencyManager::get<GlowEffect>()->render(); | |
| 904 | + auto finalFbo = DependencyManager::get<GlowEffect>()->render(); | |
| 905 | + | |
| 906 | + glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0); | |
| 907 | + glBindFramebuffer(GL_READ_FRAMEBUFFER, gpu::GLBackend::getFramebufferID(finalFbo)); | |
| 908 | + glBlitFramebuffer(0, 0, _renderResolution.x, _renderResolution.y, | |
| 909 | + 0, 0, _glWidget->getDeviceSize().width(), _glWidget->getDeviceSize().height(), | |
| 910 | + GL_COLOR_BUFFER_BIT, GL_NEAREST); | |
| 911 | + | |
| 914 | 912 | |
| 915 | 913 | { |
| 916 | 914 | PerformanceTimer perfTimer("renderOverlay"); |
| @@ -955,33 +953,47 @@ void Application::showEditEntitiesHelp() { · 38 unmodified lines | ||
| 955 | 953 | InfoView::show(INFO_EDIT_ENTITIES_PATH); |
| 956 | 954 | } |
| 957 | 955 | |
| 958 | −void Application::resetCamerasOnResizeGL(Camera& camera, int width, int height) { | |
| 956 | +void Application::resetCamerasOnResizeGL(Camera& camera, const glm::uvec2& size) { | |
| 959 | 957 | if (OculusManager::isConnected()) { |
| 960 | − OculusManager::configureCamera(camera, width, height); | |
| 958 | + OculusManager::configureCamera(camera, size.x, size.y); | |
| 961 | 959 | } else if (TV3DManager::isConnected()) { |
| 962 | − TV3DManager::configureCamera(camera, width, height); | |
| 960 | + TV3DManager::configureCamera(camera, size.x, size.y); | |
| 963 | 961 | } else { |
| 964 | − camera.setAspectRatio((float)width / height); | |
| 962 | + camera.setAspectRatio((float)size.x / size.y); | |
| 965 | 963 | camera.setFieldOfView(_fieldOfView.get()); |
| 966 | 964 | } |
| 967 | 965 | } |
| 968 | 966 | |
| 969 | −void Application::resizeGL(int width, int height) { | |
| 970 | − DependencyManager::get<TextureCache>()->setFrameBufferSize(QSize(width, height)); | |
| 971 | − resetCamerasOnResizeGL(_myCamera, width, height); | |
| 967 | +void Application::resizeGL() { | |
| 968 | + // Set the desired FBO texture size. If it hasn't changed, this does nothing. | |
| 969 | + // Otherwise, it must rebuild the FBOs | |
| 970 | + QSize renderSize; | |
| 971 | + if (OculusManager::isConnected()) { | |
| 972 | + renderSize = OculusManager::getRenderTargetSize(); | |
| 973 | + } else { | |
| 974 | + renderSize = _glWidget->getDeviceSize() * getRenderResolutionScale(); | |
| 975 | + } | |
| 976 | + if (_renderResolution == toGlm(renderSize)) { | |
| 977 | + return; | |
| 978 | + } | |
| 979 | + | |
| 980 | + _renderResolution = toGlm(renderSize); | |
| 981 | + DependencyManager::get<TextureCache>()->setFrameBufferSize(renderSize); | |
| 982 | + resetCamerasOnResizeGL(_myCamera, _renderResolution); | |
| 972 | 983 | |
| 973 | − glViewport(0, 0, width, height); // shouldn't this account for the menu??? | |
| 984 | + glViewport(0, 0, _renderResolution.x, _renderResolution.y); // shouldn't this account for the menu??? | |
| 974 | 985 | |
| 975 | 986 | updateProjectionMatrix(); |
| 976 | 987 | glLoadIdentity(); |
| 977 | 988 | |
| 978 | 989 | auto offscreenUi = DependencyManager::get<OffscreenUi>(); |
| 979 | 990 | offscreenUi->resize(_glWidget->size()); |
| 991 | + _glWidget->makeCurrent(); | |
| 980 | 992 | |
| 981 | 993 | // update Stats width |
| 982 | 994 | // let's set horizontal offset to give stats some margin to mirror |
| 983 | 995 | int horizontalOffset = MIRROR_VIEW_WIDTH + MIRROR_VIEW_LEFT_PADDING * 2; |
| 984 | − Stats::getInstance()->resetWidth(width, horizontalOffset); | |
| 996 | + Stats::getInstance()->resetWidth(_renderResolution.x, horizontalOffset); | |
| 985 | 997 | } |
| 986 | 998 | |
| 987 | 999 | void Application::updateProjectionMatrix() { |
| @@ -1819,7 +1831,7 @@ void Application::setFullscreen(bool fullscreen) { · 831 unmodified lines | ||
| 1819 | 1831 | } |
| 1820 | 1832 | |
| 1821 | 1833 | void Application::setEnable3DTVMode(bool enable3DTVMode) { |
| 1822 | − resizeGL(_glWidget->getDeviceWidth(), _glWidget->getDeviceHeight()); | |
| 1834 | + resizeGL(); | |
| 1823 | 1835 | } |
| 1824 | 1836 | |
| 1825 | 1837 | void Application::setEnableVRMode(bool enableVRMode) { |
| @@ -1844,7 +1856,7 @@ void Application::setEnableVRMode(bool enableVRMode) { · 18 unmodified lines | ||
| 1844 | 1856 | _myCamera.setHmdRotation(glm::quat()); |
| 1845 | 1857 | } |
| 1846 | 1858 | |
| 1847 | − resizeGL(_glWidget->getDeviceWidth(), _glWidget->getDeviceHeight()); | |
| 1859 | + resizeGL(); | |
| 1848 | 1860 | |
| 1849 | 1861 | updateCursorVisibility(); |
| 1850 | 1862 | } |
| @@ -3200,12 +3212,12 @@ void Application::displaySide(Camera& theCamera, bool selfAvatarOnly, RenderArgs · 1349 unmodified lines | ||
| 3200 | 3212 | _stars.render(theCamera.getFieldOfView(), theCamera.getAspectRatio(), theCamera.getNearClip(), alpha); |
| 3201 | 3213 | } |
| 3202 | 3214 | |
| 3203 | − // draw the sky dome | |
| 3204 | − if (!selfAvatarOnly && Menu::getInstance()->isOptionChecked(MenuOption::Atmosphere)) { | |
| 3205 | − PerformanceTimer perfTimer("atmosphere"); | |
| 3206 | − PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings), | |
| 3207 | − "Application::displaySide() ... atmosphere..."); | |
| 3208 | − _environment.renderAtmospheres(theCamera); | |
| 3215 | + // draw the sky dome | |
| 3216 | + if (!selfAvatarOnly && Menu::getInstance()->isOptionChecked(MenuOption::Atmosphere)) { | |
| 3217 | + PerformanceTimer perfTimer("atmosphere"); | |
| 3218 | + PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings), | |
| 3219 | + "Application::displaySide() ... atmosphere..."); | |
| 3220 | + _environment.renderAtmospheres(theCamera); | |
| 3209 | 3221 | } |
| 3210 | 3222 | |
| 3211 | 3223 | } |
| @@ -4605,7 +4617,3 @@ PickRay Application::computePickRay() const { · 1393 unmodified lines | ||
| 4605 | 4617 | bool Application::hasFocus() const { |
| 4606 | 4618 | return _glWidget->hasFocus(); |
| 4607 | 4619 | } |
| 4608 | − | |
| 4609 | −void Application::resizeGL() { | |
| 4610 | − this->resizeGL(_glWidget->getDeviceWidth(), _glWidget->getDeviceHeight()); | |
| 4611 | −} | |