simed
26-10-2011 15:16:36
I use Canvas with resizing render-texture:createTexture(Canvas::TRM_PT_VIEW_ALL, TextureUsage::RenderTarget);
When MyGUI resizes the texture, requestUpdateCanvas event is fired - and there are no viewports on the Ogre::RenderTexture now. Recreating a viewport is easy, but if I have any settings on the viewport, or even multiple viewports, it's a bit inconvenient to have to cache all these settings - like material scheme, visibility mask, background color, etc.
Can anyone suggest a way to save my existing viewport so I can re-attach to the new render-texture? I prefer not to modify MyGUI source but will consider it if I have to!
Altren
26-10-2011 17:07:59
Do you use MyGUI Canvas as container for Ogre's Viewport rendered in RTT texture? If so you can use different approach and use common RTT from Ogre demos, and then just use texture name inside MyGUI ImageBox.
I do not see any ways to handle that from canvas. That's why you have requestUpdateCanvas event and that's the right place where you should use your viewport settings and other data.
simed
26-10-2011 19:57:57
Do you use MyGUI Canvas as container for Ogre's Viewport rendered in RTT texture?
Yes I let MyGUI create the Ogre::RenderTexture and I then add a viewport to it... convenience is MyGUI does the resizing for me but it is a bit limited in flexibility...
If so you can use different approach and use common RTT from Ogre demos, and then just use texture name inside MyGUI ImageBox.
I hadn't thought of this, maybe it is better for my use-case... basically wrapping a viewport inside a 'dialog'.
If I do it this way, I own the RenderTexture and would manually have to take care of sizing it when dialog resizes, etc? Are there any other major differences between Canvas and ImageBox? Is the main differnce just that Canvas owns its own texture, ImageBox displays an external texture?
I do not see any ways to handle that from canvas. That's why you have requestUpdateCanvas event and that's the right place where you should use your viewport settings and other data.
Yes, this works OK - I re-create viewport as needed. But I think the problem is you can't detach a Viewport from the target - due to how Ogre is designed.
Altren
27-10-2011 12:23:18
If I do it this way, I own the RenderTexture and would manually have to take care of sizing it when dialog resizes, etc? Are there any other major differences between Canvas and ImageBox?
Yes, you need to manually care about that texture. ImageBox just display it and scale texture to it's own size (or scale selected part of texture if you selected any).Is the main differnce just that Canvas owns its own texture, ImageBox displays an external texture?
Yes.
simed
31-10-2011 10:59:27
I'm looking at using ImageBox, however it seems I have a choice - I could create a pure Ogre RTT, or use MyGUI::OgreTexture & MyGUI::OgreRTTTexture. The MyGUI OgrePlatform classes look like they make it a bit easier (although I don't think OgreRTTTexture maps to Ogre::RenderTexture the way the name suggests).
Is there any right/wrong way here?