ovis: correctly destroy additional windows

pull/2310/head
Pavel Rojtberg 6 years ago
parent 20dbe789ad
commit e639c8ef9a
  1. 2
      modules/ovis/samples/ovis_demo.py
  2. 18
      modules/ovis/src/ovis.cpp

@ -31,3 +31,5 @@ iwin.setCameraIntrinsics(K, imsize)
while cv.ovis.waitKey(1) != 27: while cv.ovis.waitKey(1) != 27:
R, t = iwin.getCameraPose() R, t = iwin.getCameraPose()
owin.setEntityPose("cam", t, R) owin.setEntityPose("cam", t, R)
del iwin # must be destroyed in reverse creation order

@ -238,6 +238,20 @@ struct Application : public OgreBites::ApplicationContext, public OgreBites::Inp
return ret; return ret;
} }
#if OGRE_VERSION < ((1 << 16) | (12 << 8) | 3)
void destroyWindow(const Ogre::String& name)
{
for (auto it = mWindows.begin(); it != mWindows.end(); ++it)
{
if (it->render->getName() != name)
continue;
mRoot->destroyRenderTarget(it->render);
mWindows.erase(it);
return;
}
}
#endif
size_t numWindows() const { return mWindows.size(); } size_t numWindows() const { return mWindows.size(); }
void locateResources() CV_OVERRIDE void locateResources() CV_OVERRIDE
@ -371,6 +385,10 @@ public:
_app->closeApp(); _app->closeApp();
_app.release(); _app.release();
} }
else
{
_app->destroyWindow(title);
}
} }
void setBackground(InputArray image) CV_OVERRIDE void setBackground(InputArray image) CV_OVERRIDE

Loading…
Cancel
Save