souvarine
24-02-2012 00:18:47
Hi all.
I'm using RTT to display some MyGUI buttons into an Ogre material. I did it just like in the RTT Layer example.
When I use Ogre with OpenGL it works fine. But when I switch to DirectX I get a very strange rendering problem. One frame out of two is wrong. For example if all my buttons are hidden and I show them all then I will get one frame with the buttons properly displayed, then on the next frame the buttons won't be there (as if they were still hidden), then on the next frame they will be there again and so on.
If I move the buttons then as long as they're moving they're displayed properly, but when they stop moving I get the problem again. On one frame the buttons are displayed at their correct position, on the next frame they're displayed at the position they were just before, then the next frame has correct position again and so on.
Actually my buttons are displayed properly as long as the if (outOfDate || _update) is true. If I remove this condition from the code (meaning I'm updating my texture every frame) the problem doesn't appears (but it's bad for performances so I don't wont to do that).
To me it looks like a double buffering problem but I don't understand how it's supposed to work nor how to fix it. Are render textures double buffered ? Has anyone ever seen a problem like this ? Any hints on how I could solve it ?
Thanks in advance.
I'm using RTT to display some MyGUI buttons into an Ogre material. I did it just like in the RTT Layer example.
class OblicLayer : public MyGUI::OverlappedLayer
{
...plenty of stuff...
};
void OblicLayer::renderToTarget(MyGUI::IRenderTarget* _target, bool _update)
{
bool outOfDate = false;
for (MyGUI::VectorILayerNode::iterator iter = mChildItems.begin(); iter != mChildItems.end(); ++iter)
{
if ((*iter)->castType<MyGUI::LayerNode>()->isOutOfDate())
{
outOfDate = true;
break;
}
}
if (outOfDate || _update)
{
MyGUI::IRenderTarget* target = mTexture->getRenderTarget();
if (target != 0)
{
target->begin();
for (MyGUI::VectorILayerNode::iterator iter = mChildItems.begin(); iter != mChildItems.end(); ++iter)
{
(*iter)->renderToTarget(target, _update);
}
target->end();
}
}
}
When I use Ogre with OpenGL it works fine. But when I switch to DirectX I get a very strange rendering problem. One frame out of two is wrong. For example if all my buttons are hidden and I show them all then I will get one frame with the buttons properly displayed, then on the next frame the buttons won't be there (as if they were still hidden), then on the next frame they will be there again and so on.
If I move the buttons then as long as they're moving they're displayed properly, but when they stop moving I get the problem again. On one frame the buttons are displayed at their correct position, on the next frame they're displayed at the position they were just before, then the next frame has correct position again and so on.
Actually my buttons are displayed properly as long as the if (outOfDate || _update) is true. If I remove this condition from the code (meaning I'm updating my texture every frame) the problem doesn't appears (but it's bad for performances so I don't wont to do that).
To me it looks like a double buffering problem but I don't understand how it's supposed to work nor how to fix it. Are render textures double buffered ? Has anyone ever seen a problem like this ? Any hints on how I could solve it ?
Thanks in advance.