Canvas still renders when hidden


19-10-2011 14:14:32

I noticed that when using Canvas with RenderTexture, it is still rendered to when the Canvas is not visible. And, I can't see any event which will notify me when a widget is shown/hidden. So if I construct a kind of dialog with a Canvas object as a control, I have to write bespoke logic to make sure I disable any/all Canvas controls:Ogre::TexturePtr texture = static_cast<MyGUI::OgreTexture*>(
Ogre::RenderTexture* target = texture->getBuffer()->getRenderTarget();
Since MyGUI is not Ogre-specific, I'm not even sure how I could modify the MyGUI source to prevent rendering when hidden... ideally a flag which can toggle this new behavior.
In fact looking at MyGUI_Canvas.cpp I cannot see where the texture gets updated at all, or even how Canvas gets rendered. Can anyone help me understand how it is connected together, and advise how I might implement the functionality?


24-10-2011 12:57:38

Looks like we missed this. To fix that we need to change MyGUI::Itexture interface and add something like setActive method for various platforms. And then use this method in Canvas.
I'll add new task in our tracker, but I think what you do now is easiest way so far.


24-10-2011 13:05:41

OK thanks :)