So right now I have an ogre game which works but has no gui using the standard setup where ogre does everything.
I also have a separate project where I've setup up a POC for the gui and one of the "scenes" is GLKitViewController derived. This class creates a GLES2 context. Now I need to figure out how setup ogre using this context to render in this view. So here's what I got so far. I'm in the process of trying to make it work (as in, debugging segfaults), but I'd like to know if I'm understanding it correctly.
Code: Select all
within GLKitViewController
in viewDidLoad
1) create openGLES2 context, mCtx
2) create an Ogre::Root object, mRoot
3) create an openGLES Render system object
mRenderSystem =
4) mRoot->setRenderSystem(mRenderSystem)
5) initialize the root but don't create a window
mRoot->initialize(false)
6) create parameter list, params
colourDepth = 32 # in xcode, color format rgb8888
externalWindowHandle = 0
externalGLControl = false # i think ogre should still 'own'
# the context right
externalGLContext = mCtx
externalViewHandle = mView # a GLKitView pointer
externalViewControllerHandle = this
contentScalingFactor = 2.0 # still don't understand this, but
# this value 'works' in my current
# code
7) "create" the render window
mRoot->createRenderWindow( "OgreWindow", width, height, true, params)
Also, I'm not sure if I should be using GLKitView/Controller and pass in the context pointer, or a regular UIView/Controller and no context, assuming ogre will create it.
I'd appreciate any insight!!
