is there any special things need, run some OGL or D3D code when init a CDH?
like some compile/linker settings, pre initial things, limitations, etc.
i think
plugin wizard don't have a CDH template...
the XSIGame example no longer run after XSI 7...
so i do not know where I was wrong...
i have a piece of super simple code from OGRE that can compile and run as a "Win32 Console" in VS2008, but when i put the SAME code in the init callback of CDH plugin, compile code, run it, i got some error exception related to init the graphic system, problem is they are exactly same right code.
Code: Select all
XSIPLUGINCALLBACK void CDH_Init (XSI::CRef in_pViewCtx)
{
XSI::ViewContext l_vViewContext = in_pViewCtx;
l_vViewContext.SetFlags(XSI::siWindowNotifications);
HWND handle = static_cast<HWND>(l_vViewContext.GetParentWindowHandle());
Desktop oTheDesktop = app.GetDesktop();
oTheDesktop.SuspendWin32ControlsHook();
try
{
Ogre::String lLogFileName = "OGRE_CDH.LOG";
std::auto_ptr<Ogre::Root> lRoot(
new Ogre::Root("", "", lLogFileName));
lRoot->loadPlugin("C:\\OgreSDK_vc9_v1-8-1\\bin\\Release\\RenderSystem_Direct3D9");
{
const Ogre::RenderSystemList& lRenderSystemList = Ogre::Root::getSingleton().getAvailableRenderers();
Ogre::RenderSystemList::const_iterator &r_it = lRenderSystemList.begin();
lRoot->setRenderSystem(*r_it);
lRoot->initialise(false);
}
}catch(Ogre::Exception &e)
{
std::cout<<"!!!!Ogre::Exception!!!!"<<e.what()<<std::endl;
app.LogMessage(e.what());
}catch(std::exception &e)
{
std::cout<<"!!!!std::exception!!!!"<<e.what()<<std::endl;
app.LogMessage("!!!!std::exception!!!!");
}
oTheDesktop.RestoreWin32ControlsHook();
}