From d432a3ed08c84d1d7993df2b1bfffbd9f6e26e87 Mon Sep 17 00:00:00 2001 From: scrawl Date: Sat, 9 May 2015 00:13:22 +0200 Subject: [PATCH] Fix MyGUI rendering not taking DataVariance of textures into account --- components/myguiplatform/myguirendermanager.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/components/myguiplatform/myguirendermanager.cpp b/components/myguiplatform/myguirendermanager.cpp index e9a6f8c4e..442b6be78 100644 --- a/components/myguiplatform/myguirendermanager.cpp +++ b/components/myguiplatform/myguirendermanager.cpp @@ -401,6 +401,9 @@ void RenderManager::destroyVertexBuffer(MyGUI::IVertexBuffer *buffer) void RenderManager::begin() { + mDrawable->clear(); + // variance will be recomputed based on textures being rendered in this frame + mDrawable->setDataVariance(osg::Object::STATIC); } void RenderManager::doRender(MyGUI::IVertexBuffer *buffer, MyGUI::ITexture *texture, size_t count) @@ -410,7 +413,11 @@ void RenderManager::doRender(MyGUI::IVertexBuffer *buffer, MyGUI::ITexture *text batch.mVertexBuffer = static_cast(buffer)->getBuffer(); batch.mArray = static_cast(buffer)->getArray(); if (texture) + { batch.mTexture = static_cast(texture)->getTexture(); + if (batch.mTexture->getDataVariance() == osg::Object::DYNAMIC) + mDrawable->setDataVariance(osg::Object::DYNAMIC); // only for this frame, reset in begin() + } mDrawable->addBatch(batch); } @@ -433,8 +440,9 @@ void RenderManager::update() void RenderManager::collectDrawCalls() { - mDrawable->clear(); + begin(); onRenderToTarget(this, mUpdate); + end(); mUpdate = false; }