RTT rendering problem

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.


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.

Altren

25-02-2012 13:59:24

Does MyGUI demos with RTT works fine for you?

souvarine

25-02-2012 21:39:53

No it doesn't :(

Altren

26-02-2012 00:40:24

Open Ogre demos with RTT and check if you have similar problem there.
That might be either your custom Ogre build problem or may be even some drivers/hardware problem.
We never had such behaviour with RTT in MyGUI demos and I don't think that anything in MyGUI code might cause that.