Make sure not to add duplicate viewports (Fixes #1832)

Wasn't a problem while testing reload() on linux. Maybe an implementation difference with Ogre's D3D rendersystem?
This commit is contained in:
scrawl 2014-08-19 19:47:46 +02:00
parent 7b2070de5a
commit f4b5662562

View file

@ -32,6 +32,7 @@ namespace Render
void SelectionBuffer::setupRenderTarget() void SelectionBuffer::setupRenderTarget()
{ {
mRenderTarget = mTexture->getBuffer()->getRenderTarget(); mRenderTarget = mTexture->getBuffer()->getRenderTarget();
mRenderTarget->removeAllViewports();
Ogre::Viewport* vp = mRenderTarget->addViewport(mCamera); Ogre::Viewport* vp = mRenderTarget->addViewport(mCamera);
vp->setOverlaysEnabled(false); vp->setOverlaysEnabled(false);
vp->setBackgroundColour(Ogre::ColourValue(0, 0, 0, 0)); vp->setBackgroundColour(Ogre::ColourValue(0, 0, 0, 0));
@ -65,6 +66,7 @@ namespace Render
{ {
Ogre::MaterialManager::getSingleton ().addListener (this); Ogre::MaterialManager::getSingleton ().addListener (this);
mTexture->load();
if (mRenderTarget == NULL) if (mRenderTarget == NULL)
setupRenderTarget(); setupRenderTarget();