|
我接触OGRE才几天,遇到的问题如果太过于肤浅请诸位不要笑话。
我这里有个项目,类似于GoogleEarth,原先是用DirectX做的,现在要转移平台,选择了MOGRE,
当我创建一个RenderWindow的时候是需要嵌入其他窗口的,但是在初始化输入(InputHandler)的时候
出现异常情况:
PS: 如果我使用root.Initialize(true)所得到的RenderWindow的话就正常,请高人指点迷津
Microsoft Visual C++ Runtime Library
Runtime Error!
Program:...iles\OgreSDK\bin\Release\OgreEart.vhost.exe
This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.
代码是参照Sample中写的
/// <summary>
/// 创建渲染窗体
/// <param name="handle">用于渲染状态的窗口句柄</param>
/// </summary>
protected virtual RenderWindow CreateRenderWindow(IntPtr handle, Mogre.Root root)
{
RenderWindow result = null;
if (handle != IntPtr.Zero)
{
System.Drawing.Rectangle rect = user32.GetWindowRect(handle);
NameValuePairList misc = new NameValuePairList();
misc["externalWindowHandle"] = handle.ToString();
result = root.CreateRenderWindow("Simple Mogre Form Window",
(uint)rect.Width, (uint)rect.Height, false, misc);
}
else
{
result = root.CreateRenderWindow("Autumn main RenderWindow",
(uint)0, (uint)0, false);
}
return result;
}
protected virtual void CreateInputHandler()
{
MOIS.ParamList pl = new MOIS.ParamList();
IntPtr windowHnd;
mWindow.GetCustomAttribute("WINDOW", out windowHnd);
pl.Insert("WINDOW", windowHnd.ToString());
mInputManager = MOIS.InputManager.CreateInputSystem(pl);
//Create all devices (We only catch joystick exceptions here, as, most people have Key/Mouse)
>>>>>>>就是在执行这个代码时出现了上面所说的异常信息框<<<<<<<
mInputKeyboard = (MOIS.Keyboard)mInputManager.CreateInputObject(MOIS.Type.OISKeyboard, false);
mInputMouse = (MOIS.Mouse)mInputManager.CreateInputObject(MOIS.Type.OISMouse, false);
} |
|