- Get rid of the different GlowModes since we found the correct one (DIFFUSE and ADD) Get rid of the ui to change the mode - INtroduce a "RenderResolutionScale" in the application that controls the ratio ofthe resolution between the framebuffers and the native window provided by Qt - In the paintGL, in the default rendering path: the rendering Framebuffers are resized to the window.size * renderResolutionScale. The viewport is assigned to the framebuffer size from GlowEffect.prepare() to GlowEffect.render() (and not the original GLCanvas size) at the end of GLowEffect render, the final step is to blit the colorbuffer from the rendering into the window's default framebuffer at the original resolution, and that requires one more glViewport - add the ui in developer/render/ menu "scale resolution" where you can select the scaling level. THis should show in the rendering with ugly aliasing when selecting a scale under 1/2.
Showing the changes to interface/src/Application.cpp (1 of 8 files). Show all
Unified · Split
| @@ -179,7 +179,8 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) : · 178 unmodified lines | |||
| 179 | _runningScriptsWidgetWasVisible(false), | 179 | _runningScriptsWidgetWasVisible(false), |
| 180 | _trayIcon(new QSystemTrayIcon(_window)), | 180 | _trayIcon(new QSystemTrayIcon(_window)), |
| 181 | _lastNackTime(usecTimestampNow()), | 181 | _lastNackTime(usecTimestampNow()), |
| 182 | _lastSendDownstreamAudioStats(usecTimestampNow()) | 182 | _lastSendDownstreamAudioStats(usecTimestampNow()), |
| 183 | _renderResolutionScale(1.0f) | ||
| 183 | { | 184 | { |
| 184 | // read the ApplicationInfo.ini file for Name/Version/Domain information | 185 | // read the ApplicationInfo.ini file for Name/Version/Domain information |
| 185 | QSettings applicationInfo(Application::resourcesPath() + "info/ApplicationInfo.ini", QSettings::IniFormat); | 186 | QSettings applicationInfo(Application::resourcesPath() + "info/ApplicationInfo.ini", QSettings::IniFormat); |
| @@ -598,7 +599,8 @@ void Application::paintGL() { · 412 unmodified lines | |||
| 598 | if (OculusManager::isConnected()) { | 599 | if (OculusManager::isConnected()) { |
| 599 | _textureCache.setFrameBufferSize(OculusManager::getRenderTargetSize()); | 600 | _textureCache.setFrameBufferSize(OculusManager::getRenderTargetSize()); |
| 600 | } else { | 601 | } else { |
| 601 | _textureCache.setFrameBufferSize(_glWidget->getDeviceSize()); | 602 | QSize fbSize = _glWidget->getDeviceSize() * _renderResolutionScale; |
| 603 | _textureCache.setFrameBufferSize(fbSize); | ||
| 602 | } | 604 | } |
| 603 | 605 | ||
| 604 | glEnable(GL_LINE_SMOOTH); | 606 | glEnable(GL_LINE_SMOOTH); |
| @@ -696,6 +698,10 @@ void Application::paintGL() { · 91 unmodified lines | |||
| 696 | } else { | 698 | } else { |
| 697 | _glowEffect.prepare(); | 699 | _glowEffect.prepare(); |
| 698 | 700 | ||
| 701 | // Viewport is assigned to the size of the framebuffer | ||
| 702 | QSize size = Application::getInstance()->getTextureCache()->getPrimaryFramebufferObject()->size(); | ||
| 703 | glViewport( 0, 0, size.width(), size.height()); | ||
| 704 | |||
| 699 | glMatrixMode(GL_MODELVIEW); | 705 | glMatrixMode(GL_MODELVIEW); |
| 700 | glPushMatrix(); | 706 | glPushMatrix(); |
| 701 | glLoadIdentity(); | 707 | glLoadIdentity(); |
| @@ -3096,6 +3102,10 @@ glm::vec2 Application::getScaledScreenPoint(glm::vec2 projectedPoint) { · 2394 unmodified lines | |||
| 3096 | } | 3102 | } |
| 3097 | 3103 | ||
| 3098 | void Application::renderRearViewMirror(const QRect& region, bool billboard) { | 3104 | void Application::renderRearViewMirror(const QRect& region, bool billboard) { |
| 3105 | // Grab current viewport to reset it at the end | ||
| 3106 | int viewport[4]; | ||
| 3107 | glGetIntegerv(GL_VIEWPORT, viewport); | ||
| 3108 | |||
| 3099 | bool eyeRelativeCamera = false; | 3109 | bool eyeRelativeCamera = false; |
| 3100 | if (billboard) { | 3110 | if (billboard) { |
| 3101 | _mirrorCamera.setFieldOfView(BILLBOARD_FIELD_OF_VIEW); // degees | 3111 | _mirrorCamera.setFieldOfView(BILLBOARD_FIELD_OF_VIEW); // degees |
| @@ -3127,14 +3137,17 @@ void Application::renderRearViewMirror(const QRect& region, bool billboard) { · 25 unmodified lines | |||
| 3127 | 3137 | ||
| 3128 | // set the bounds of rear mirror view | 3138 | // set the bounds of rear mirror view |
| 3129 | if (billboard) { | 3139 | if (billboard) { |
| 3130 | glViewport(region.x(), _glWidget->getDeviceHeight() - region.y() - region.height(), region.width(), region.height()); | 3140 | QSize size = getTextureCache()->getFrameBufferSize(); |
| 3131 | glScissor(region.x(), _glWidget->getDeviceHeight() - region.y() - region.height(), region.width(), region.height()); | 3141 | glViewport(region.x(), size.height() - region.y() - region.height(), region.width(), region.height()); |
| 3142 | glScissor(region.x(), size.height() - region.y() - region.height(), region.width(), region.height()); | ||
| 3132 | } else { | 3143 | } else { |
| 3133 | // if not rendering the billboard, the region is in device independent coordinates; must convert to device | 3144 | // if not rendering the billboard, the region is in device independent coordinates; must convert to device |
| 3145 | QSize size = getTextureCache()->getFrameBufferSize(); | ||
| 3134 | float ratio = QApplication::desktop()->windowHandle()->devicePixelRatio(); | 3146 | float ratio = QApplication::desktop()->windowHandle()->devicePixelRatio(); |
| 3147 | ratio = size.height() / float(_glWidget->getDeviceHeight()); | ||
| 3135 | int x = region.x() * ratio, y = region.y() * ratio, width = region.width() * ratio, height = region.height() * ratio; | 3148 | int x = region.x() * ratio, y = region.y() * ratio, width = region.width() * ratio, height = region.height() * ratio; |
| 3136 | glViewport(x, _glWidget->getDeviceHeight() - y - height, width, height); | 3149 | glViewport(x, size.height() - y - height, width, height); |
| 3137 | glScissor(x, _glWidget->getDeviceHeight() - y - height, width, height); | 3150 | glScissor(x, size.height() - y - height, width, height); |
| 3138 | } | 3151 | } |
| 3139 | bool updateViewFrustum = false; | 3152 | bool updateViewFrustum = false; |
| 3140 | updateProjectionMatrix(_mirrorCamera, updateViewFrustum); | 3153 | updateProjectionMatrix(_mirrorCamera, updateViewFrustum); |
| @@ -3202,7 +3215,7 @@ void Application::renderRearViewMirror(const QRect& region, bool billboard) { · 61 unmodified lines | |||
| 3202 | } | 3215 | } |
| 3203 | 3216 | ||
| 3204 | // reset Viewport and projection matrix | 3217 | // reset Viewport and projection matrix |
| 3205 | glViewport(0, 0, _glWidget->getDeviceWidth(), _glWidget->getDeviceHeight()); | 3218 | glViewport(viewport[0], viewport[1], viewport[2], viewport[3]); |
| 3206 | glDisable(GL_SCISSOR_TEST); | 3219 | glDisable(GL_SCISSOR_TEST); |
| 3207 | updateProjectionMatrix(_myCamera, updateViewFrustum); | 3220 | updateProjectionMatrix(_myCamera, updateViewFrustum); |
| 3208 | } | 3221 | } |
| @@ -4239,3 +4252,7 @@ void Application::takeSnapshot() { · 1030 unmodified lines | |||
| 4239 | } | 4252 | } |
| 4240 | _snapshotShareDialog->show(); | 4253 | _snapshotShareDialog->show(); |
| 4241 | } | 4254 | } |
| 4255 | |||
| 4256 | void Application::setRenderResolutionScale(float scale) { | ||
| 4257 | _renderResolutionScale = scale; | ||
| 4258 | } | ||