Specifying the Axiom Render Window
From Axiom
By default Axiom renders to a window the engine creates automatically for you. If you want to override this, do the following:
This example assumes you know how Axiom is setup, look at the techdemo.cs class if you don't.
The code to create a new window is relatively simple. To create your own render window, then, first initialize the RenderSystem with a false parameters, like so:
Root.Instance.Initialize(false);
Initializing it with a "true" parameter causes Axiom to create a render window for you.
Then, you can create a new render window with the Root.Instance.CreateRenderWindow method. This example comes from the Chronos codebase.
??? width and height of the CreateRenderWindow I think have changed to actual pixel height of the control you want to setup.
Ex: mWindow = Engine.Instance.RenderSystem.CreateRenderWindow(mName, frm.Size.Width, frm.Size.Height, 32, False, 0, 0, True, frm);
public RenderWindow CreateRenderWindow(Control target)
{
// We cannot set up a window without an active rendersystem.
Debug.Assert(Root.Instance.RenderSystem != null, "Cannot create a RenderWindow without an active RenderSystem.");
// Create a new render window via the current render system
// The parameters are as follows:
// string window name - Name of this render window. Must be unique.
// int width - The width of the render window (for clean image)of the control. Default 100??.
// int height - The height of the render window of the control. Default 100??.
// int colorDepth - The color depth of this window. Will be either 16, 24, 32
// bool isFullscreen - boolean indicating whether or not this window should be fullscreen
// int left - The horizontal origin of the render surface in the control. Default is 0.
// int top - The vertical origin of the render surface in the control. Default is 0.
// bool depthBuffer - Boolean indicating whether or not to use a depth buffer. Default true.
// bool vsync - Boolean indicating whether or not to synch rendering to the monitor's refresh rate.
// Control target - Target control to render onto. This must be a Form or PictureBox.
RenderWindow rWin = Root.Instance.CreateRenderWindow(
"__window" + windowCount.ToString(), target.Width, target.Height, bpp, false, 0,
0, true, true, target);
// Here, windowCount maintains a count of render windows created. If the count is zero,
// then we want to do some setup. Doing this for every window created will cause exceptions.
if(windowCount == 0)
{
Root.Instance.SceneManager.ShadowTechnique = ShadowTechnique.StencilModulative;
// set default mipmap level
TextureManager.Instance.DefaultNumMipMaps = 5;
// retreive and initialize the input system
input = PlatformManager.Instance.CreateInputReader();
// The details of input handling are up to you. In this case, I'm instructing the
// window to not capture control of the mouse.
input.Initialize(rWin, true, true, false, false);
}
windowCount++;
return rWin;
}
This does assume that you've already set up the engine and initialized a render system.
--Antiarc 11:10, 19 Jan 2005 (MST)

