mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-05-29 09:39:55 +02:00
fix resolution option
This commit is contained in:
parent
4ce4afe0b1
commit
c57c15f22c
7 changed files with 19 additions and 7 deletions
|
@ -3221,7 +3221,8 @@ void Application::resizeGL() {
|
||||||
// Set the desired FBO texture size. If it hasn't changed, this does nothing.
|
// Set the desired FBO texture size. If it hasn't changed, this does nothing.
|
||||||
// Otherwise, it must rebuild the FBOs
|
// Otherwise, it must rebuild the FBOs
|
||||||
uvec2 framebufferSize = displayPlugin->getRecommendedRenderSize();
|
uvec2 framebufferSize = displayPlugin->getRecommendedRenderSize();
|
||||||
uvec2 renderSize = uvec2(vec2(framebufferSize) * getRenderResolutionScale());
|
float renderResolutionScale = getRenderResolutionScale();
|
||||||
|
uvec2 renderSize = uvec2(vec2(framebufferSize) * renderResolutionScale);
|
||||||
if (_renderResolution != renderSize) {
|
if (_renderResolution != renderSize) {
|
||||||
_renderResolution = renderSize;
|
_renderResolution = renderSize;
|
||||||
DependencyManager::get<FramebufferCache>()->setFrameBufferSize(fromGlm(renderSize));
|
DependencyManager::get<FramebufferCache>()->setFrameBufferSize(fromGlm(renderSize));
|
||||||
|
@ -3238,6 +3239,7 @@ void Application::resizeGL() {
|
||||||
}
|
}
|
||||||
|
|
||||||
DependencyManager::get<OffscreenUi>()->resize(fromGlm(displayPlugin->getRecommendedUiSize()));
|
DependencyManager::get<OffscreenUi>()->resize(fromGlm(displayPlugin->getRecommendedUiSize()));
|
||||||
|
displayPlugin->setRenderResolutionScale(renderResolutionScale);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Application::handleSandboxStatus(QNetworkReply* reply) {
|
void Application::handleSandboxStatus(QNetworkReply* reply) {
|
||||||
|
|
|
@ -105,7 +105,7 @@ void Application::paintGL() {
|
||||||
PerformanceTimer perfTimer("renderOverlay");
|
PerformanceTimer perfTimer("renderOverlay");
|
||||||
// NOTE: There is no batch associated with this renderArgs
|
// NOTE: There is no batch associated with this renderArgs
|
||||||
// the ApplicationOverlay class assumes it's viewport is setup to be the device size
|
// the ApplicationOverlay class assumes it's viewport is setup to be the device size
|
||||||
renderArgs._viewport = glm::ivec4(0, 0, getDeviceSize());
|
renderArgs._viewport = glm::ivec4(0, 0, getDeviceSize() * getRenderResolutionScale());
|
||||||
_applicationOverlay.renderOverlay(&renderArgs);
|
_applicationOverlay.renderOverlay(&renderArgs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -179,7 +179,7 @@ static const auto DEPTH_FORMAT = gpu::Element(gpu::SCALAR, gpu::FLOAT, gpu::DEPT
|
||||||
void ApplicationOverlay::buildFramebufferObject() {
|
void ApplicationOverlay::buildFramebufferObject() {
|
||||||
PROFILE_RANGE(app, __FUNCTION__);
|
PROFILE_RANGE(app, __FUNCTION__);
|
||||||
|
|
||||||
auto uiSize = qApp->getUiSize();
|
auto uiSize = glm::uvec2(glm::vec2(qApp->getUiSize()) * qApp->getRenderResolutionScale());
|
||||||
if (!_overlayFramebuffer || uiSize != _overlayFramebuffer->getSize()) {
|
if (!_overlayFramebuffer || uiSize != _overlayFramebuffer->getSize()) {
|
||||||
_overlayFramebuffer = gpu::FramebufferPointer(gpu::Framebuffer::create("ApplicationOverlay"));
|
_overlayFramebuffer = gpu::FramebufferPointer(gpu::Framebuffer::create("ApplicationOverlay"));
|
||||||
}
|
}
|
||||||
|
|
|
@ -118,7 +118,7 @@ void Overlays::renderHUD(RenderArgs* renderArgs) {
|
||||||
auto geometryCache = DependencyManager::get<GeometryCache>();
|
auto geometryCache = DependencyManager::get<GeometryCache>();
|
||||||
auto textureCache = DependencyManager::get<TextureCache>();
|
auto textureCache = DependencyManager::get<TextureCache>();
|
||||||
|
|
||||||
auto size = qApp->getUiSize();
|
auto size = glm::uvec2(glm::vec2(qApp->getUiSize()) * qApp->getRenderResolutionScale());
|
||||||
int width = size.x;
|
int width = size.x;
|
||||||
int height = size.y;
|
int height = size.y;
|
||||||
mat4 legacyProjection = glm::ortho<float>(0, width, height, 0, -1000, 1000);
|
mat4 legacyProjection = glm::ortho<float>(0, width, height, 0, -1000, 1000);
|
||||||
|
|
|
@ -275,7 +275,7 @@ bool CompositorHelper::getReticleOverDesktop() const {
|
||||||
// as being over the desktop.
|
// as being over the desktop.
|
||||||
if (isHMD()) {
|
if (isHMD()) {
|
||||||
QMutexLocker locker(&_reticleLock);
|
QMutexLocker locker(&_reticleLock);
|
||||||
glm::vec2 maxOverlayPosition = _currentDisplayPlugin->getRecommendedUiSize();
|
glm::vec2 maxOverlayPosition = glm::vec2(_currentDisplayPlugin->getRecommendedUiSize()) * _currentDisplayPlugin->getRenderResolutionScale();
|
||||||
static const glm::vec2 minOverlayPosition;
|
static const glm::vec2 minOverlayPosition;
|
||||||
if (glm::any(glm::lessThan(_reticlePositionInHMD, minOverlayPosition)) ||
|
if (glm::any(glm::lessThan(_reticlePositionInHMD, minOverlayPosition)) ||
|
||||||
glm::any(glm::greaterThan(_reticlePositionInHMD, maxOverlayPosition))) {
|
glm::any(glm::greaterThan(_reticlePositionInHMD, maxOverlayPosition))) {
|
||||||
|
@ -317,7 +317,7 @@ void CompositorHelper::sendFakeMouseEvent() {
|
||||||
|
|
||||||
void CompositorHelper::setReticlePosition(const glm::vec2& position, bool sendFakeEvent) {
|
void CompositorHelper::setReticlePosition(const glm::vec2& position, bool sendFakeEvent) {
|
||||||
if (isHMD()) {
|
if (isHMD()) {
|
||||||
glm::vec2 maxOverlayPosition = _currentDisplayPlugin->getRecommendedUiSize();
|
glm::vec2 maxOverlayPosition = glm::vec2(_currentDisplayPlugin->getRecommendedUiSize()) * _currentDisplayPlugin->getRenderResolutionScale();
|
||||||
// FIXME don't allow negative mouseExtra
|
// FIXME don't allow negative mouseExtra
|
||||||
glm::vec2 mouseExtra = (MOUSE_EXTENTS_PIXELS - maxOverlayPosition) / 2.0f;
|
glm::vec2 mouseExtra = (MOUSE_EXTENTS_PIXELS - maxOverlayPosition) / 2.0f;
|
||||||
glm::vec2 minMouse = vec2(0) - mouseExtra;
|
glm::vec2 minMouse = vec2(0) - mouseExtra;
|
||||||
|
|
|
@ -885,7 +885,7 @@ OpenGLDisplayPlugin::~OpenGLDisplayPlugin() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void OpenGLDisplayPlugin::updateCompositeFramebuffer() {
|
void OpenGLDisplayPlugin::updateCompositeFramebuffer() {
|
||||||
auto renderSize = getRecommendedRenderSize();
|
auto renderSize = glm::uvec2(glm::vec2(getRecommendedRenderSize()) * getRenderResolutionScale());
|
||||||
if (!_compositeFramebuffer || _compositeFramebuffer->getSize() != renderSize) {
|
if (!_compositeFramebuffer || _compositeFramebuffer->getSize() != renderSize) {
|
||||||
_compositeFramebuffer = gpu::FramebufferPointer(gpu::Framebuffer::create("OpenGLDisplayPlugin::composite", gpu::Element::COLOR_RGBA_32, renderSize.x, renderSize.y));
|
_compositeFramebuffer = gpu::FramebufferPointer(gpu::Framebuffer::create("OpenGLDisplayPlugin::composite", gpu::Element::COLOR_RGBA_32, renderSize.x, renderSize.y));
|
||||||
}
|
}
|
||||||
|
|
|
@ -140,6 +140,14 @@ public:
|
||||||
virtual void setContext(const gpu::ContextPointer& context) final { _gpuContext = context; }
|
virtual void setContext(const gpu::ContextPointer& context) final { _gpuContext = context; }
|
||||||
virtual void submitFrame(const gpu::FramePointer& newFrame) = 0;
|
virtual void submitFrame(const gpu::FramePointer& newFrame) = 0;
|
||||||
|
|
||||||
|
virtual float getRenderResolutionScale() const {
|
||||||
|
return _renderResolutionScale;
|
||||||
|
}
|
||||||
|
|
||||||
|
void setRenderResolutionScale(float renderResolutionScale) {
|
||||||
|
_renderResolutionScale = renderResolutionScale;
|
||||||
|
}
|
||||||
|
|
||||||
// The size of the rendering target (may be larger than the device size due to distortion)
|
// The size of the rendering target (may be larger than the device size due to distortion)
|
||||||
virtual glm::uvec2 getRecommendedRenderSize() const = 0;
|
virtual glm::uvec2 getRecommendedRenderSize() const = 0;
|
||||||
|
|
||||||
|
@ -220,6 +228,8 @@ protected:
|
||||||
|
|
||||||
MovingAverage<float, 10> _movingAveragePresent;
|
MovingAverage<float, 10> _movingAveragePresent;
|
||||||
|
|
||||||
|
float _renderResolutionScale { 1.0f };
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QMutex _presentMutex;
|
QMutex _presentMutex;
|
||||||
QWaitCondition _presentCondition;
|
QWaitCondition _presentCondition;
|
||||||
|
|
Loading…
Reference in a new issue