27-08-2006 14:34:38

I'm making a UserControl that will serve as the rendering window for Ogre and provide a interface specific to my application to the form it's placed on. In the UserControl's Resize event I'm just calling the camera's SetAspectRatio to set it to the ratio of the UserControl's new size. When the UserControl is resized at runtime, Ogre continues to draw on the entire resized surface and the aspect ratio remains correct.

My question is... what is RenderWindow.Resize(x,y) for? At first RenderWindow.x and .y match my UserControl's size. But as the UserControl is resized and Ogre seems to "resize" along with it, RenderWindow.x and .y don't change from their initial values. If I call RenderWindow(x, y) to change it, RenderWindow.x and .y STILL don't change. They seem to ignore the call to Resize. Am I doing something wrong, or is RenderWindow.Resize just not needed when you're rending to a window/control? Or is Ogre always rendering to my UserControl's initial size and just scaling the rendered image down to match the UserControl's current size? I did notice that even if I resize the UserControl down very small, the rendering doesn't get any faster.



27-08-2006 18:21:49

Resize if used for non-embedded apps really. It will resize the Win32 HWND itself.. which doesn't really have much effect when called from an embedded window ;)

You can use WindowMovedOrResized() to readjust the aspect and internal Ogre settings automatically. Note: Do not use that method on the primary window when you have more then one renderwindow open.


28-08-2006 04:56:18

Thanks for clearing that up for me. I am now calling RenderWindow.WindowMovedOrResized() but that alone doesn't adjust the camera's aspect ratio. I also have to call Camera.SetAspectRatio(Usercontrol.Height / Usercontrol.Width) to get the aspect ratio correct as the UserControl is resized. (The Height/Width seemed backwards, but it worked. Width/Height made the aspect ratio all wacked out as the window was resized)


28-08-2006 06:43:43

camera.AutoAspectRation = true; will handle that, sorry :)


28-08-2006 08:13:22

Yep, that did it. Thanks! :D