mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-03-15 07:29:15 +01:00
LP-32 workaround lost texture when switching tab
This commit is contained in:
parent
33b052947b
commit
4cd817fe3a
@ -181,6 +181,8 @@ public:
|
||||
|
||||
bool busy;
|
||||
|
||||
static osg::ref_ptr<osg::GraphicsContext> dummyGC;
|
||||
|
||||
static QtKeyboardMap keyMap;
|
||||
|
||||
Hidden(OSGViewport *self) : QObject(self), self(self), window(NULL), frameTimer(-1),
|
||||
@ -188,6 +190,13 @@ public:
|
||||
{
|
||||
OsgEarth::initialize();
|
||||
|
||||
// workaround to avoid using GraphicsContext #0
|
||||
// when switching tabs textures are not rebound (see https://librepilot.atlassian.net/secure/attachment/11500/lost_textures.png)
|
||||
// so we create and retain GraphicsContext #0 so it won't be used elsewhere
|
||||
if (!dummyGC.valid()) {
|
||||
dummyGC = createGraphicsContext();
|
||||
}
|
||||
|
||||
createViewer();
|
||||
|
||||
connect(self, &OSGViewport::windowChanged, this, &Hidden::onWindowChanged);
|
||||
@ -491,7 +500,7 @@ private:
|
||||
traits->x = 0;
|
||||
traits->y = 0;
|
||||
|
||||
int dpr = self->window()->devicePixelRatio();
|
||||
int dpr = self->window() ? self->window()->devicePixelRatio() : 1;
|
||||
traits->width = self->width() * dpr;
|
||||
traits->height = self->height() * dpr;
|
||||
|
||||
@ -699,6 +708,8 @@ public:
|
||||
|
||||
QtKeyboardMap OSGViewport::Hidden::keyMap = QtKeyboardMap();
|
||||
|
||||
osg::ref_ptr<osg::GraphicsContext> OSGViewport::Hidden::dummyGC;
|
||||
|
||||
/* class OSGViewport */
|
||||
|
||||
OSGViewport::OSGViewport(QQuickItem *parent) : Inherited(parent), h(new Hidden(this))
|
||||
|
Loading…
x
Reference in New Issue
Block a user