mirror of
https://github.com/Armored-Dragon/overte.git
synced 2025-03-11 16:13:16 +01:00
Fixing offscreen rendering on retina display, even without a proxy window
This commit is contained in:
parent
ad5f1214bf
commit
a0097bcff8
4 changed files with 16 additions and 3 deletions
|
@ -4690,6 +4690,11 @@ int Application::getMaxOctreePacketsPerSecond() {
|
||||||
return _maxOctreePPS;
|
return _maxOctreePPS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
qreal Application::getDevicePixelRatio() {
|
||||||
|
return _window ? _window->windowHandle()->devicePixelRatio() : 1.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
AbstractViewStateInterface* AbstractViewStateInterface::instance() {
|
AbstractViewStateInterface* AbstractViewStateInterface::instance() {
|
||||||
return qApp;
|
return qApp;
|
||||||
}
|
}
|
||||||
|
|
|
@ -300,7 +300,7 @@ public:
|
||||||
virtual const glm::vec3& getAvatarPosition() const { return _myAvatar->getPosition(); }
|
virtual const glm::vec3& getAvatarPosition() const { return _myAvatar->getPosition(); }
|
||||||
virtual void overrideEnvironmentData(const EnvironmentData& newData) { _environment.override(newData); }
|
virtual void overrideEnvironmentData(const EnvironmentData& newData) { _environment.override(newData); }
|
||||||
virtual void endOverrideEnvironmentData() { _environment.endOverride(); }
|
virtual void endOverrideEnvironmentData() { _environment.endOverride(); }
|
||||||
|
virtual qreal getDevicePixelRatio();
|
||||||
|
|
||||||
NodeBounds& getNodeBoundsDisplay() { return _nodeBoundsDisplay; }
|
NodeBounds& getNodeBoundsDisplay() { return _nodeBoundsDisplay; }
|
||||||
|
|
||||||
|
|
|
@ -56,6 +56,7 @@ public:
|
||||||
virtual const glm::vec3& getAvatarPosition() const = 0;
|
virtual const glm::vec3& getAvatarPosition() const = 0;
|
||||||
|
|
||||||
virtual void postLambdaEvent(std::function<void()> f) = 0;
|
virtual void postLambdaEvent(std::function<void()> f) = 0;
|
||||||
|
virtual qreal getDevicePixelRatio() = 0;
|
||||||
|
|
||||||
static AbstractViewStateInterface* instance();
|
static AbstractViewStateInterface* instance();
|
||||||
};
|
};
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
#include <QOpenGLDebugLogger>
|
#include <QOpenGLDebugLogger>
|
||||||
#include <QGLWidget>
|
#include <QGLWidget>
|
||||||
#include <QtQml>
|
#include <QtQml>
|
||||||
|
#include "AbstractViewStateInterface.h"
|
||||||
|
|
||||||
Q_DECLARE_LOGGING_CATEGORY(offscreenFocus)
|
Q_DECLARE_LOGGING_CATEGORY(offscreenFocus)
|
||||||
Q_LOGGING_CATEGORY(offscreenFocus, "hifi.offscreen.focus")
|
Q_LOGGING_CATEGORY(offscreenFocus, "hifi.offscreen.focus")
|
||||||
|
@ -87,8 +88,14 @@ void OffscreenQmlSurface::create(QOpenGLContext* shareContext) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void OffscreenQmlSurface::resize(const QSize& newSize) {
|
void OffscreenQmlSurface::resize(const QSize& newSize) {
|
||||||
|
// Qt bug in 5.4 forces this check of pixel ratio,
|
||||||
qreal pixelRatio = _renderControl->_renderWindow ? _renderControl->_renderWindow->devicePixelRatio() : 1.0;
|
// even though we're rendering offscreen.
|
||||||
|
qreal pixelRatio = 1.0;
|
||||||
|
if (_renderControl && _renderControl->_renderWindow) {
|
||||||
|
pixelRatio = _renderControl->_renderWindow->devicePixelRatio();
|
||||||
|
} else {
|
||||||
|
pixelRatio = AbstractViewStateInterface::instance()->getDevicePixelRatio();
|
||||||
|
}
|
||||||
QSize newOffscreenSize = newSize * pixelRatio;
|
QSize newOffscreenSize = newSize * pixelRatio;
|
||||||
if (newOffscreenSize == _fboCache.getSize()) {
|
if (newOffscreenSize == _fboCache.getSize()) {
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Reference in a new issue