after hours of searching and trying i've managed to control the location of ogre in the hierarchy of my application and thought i'll share my experience (and thanks to masterflacon).
the steps are:
1. start a new project so that everything is attached in the MainWindow
2. add OgreDemoApp and OgreFramework fro the template
3. add a pointer to a new variable of type OgreDemoApp
4. instantiate your pointer wherever you want using 'mOgre = new DemoApp();'
4. copy the function "go" from the template
5. call go function to when you want to start rendering
6. dont forget to take the - (void)renderOneFrame:(id)sender and the rest of the 'application' functions you want from the AppDelegate class
if you want another viewcontroller on top of ogre: (for example for touch interface)
1. add a UIViewController
2. add the folowing
Code: Select all
window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; // of type uiwindow
mTouchViewController = [[TouchViewController alloc] initWithNibName:@"TouchViewController" bundle:nil delegate:self];
window.rootViewController = mTouchViewController; //if you want uiview it'l be [window addSubview:yourView];
1. get Ogre uiwindow via: (in OgreFramework::initOgre)
Code: Select all
..
m_pRenderWnd = m_pRoot->initialise(true, wndTitle);
..
RenderWindow *mWindow = Ogre::Root::getSingleton().getAutoCreatedWindow();
mWindow->getCustomAttribute("WINDOW", &mUIWindow); //mUIWindow is of type UIWindow
Code: Select all
//window is a UIWindow
window.windowLevel = 3.0 ; // a float
to make Ogre's background transparent all i did was: (in OgreFramework::initOgre)
Code: Select all
UIView *view;
mWindow->getCustomAttribute("VIEW", &view);
view.layer.opaque = NO;
....
m_pViewport->setBackgroundColour(ColourValue(0.0f, 0.0f, 0.0f, 0.0f));
dowi