Odd Rendering Behaviour on OSX 10.9 (Mavericks)

Discussion area about developing or extending OGRE, adding plugins for it or building applications on it. No newbie questions please, use the Help forum for that.
Post Reply
Posts: 36
Joined: Wed Mar 28, 2012 2:00 pm

Odd Rendering Behaviour on OSX 10.9 (Mavericks)

Post by chocoanzak »

I am developing a 32-bit Mac application using Ogre 1.8 and am having an issue when trying to render the view. I have tried using the sample code from Tutorial 2 to build and run a simple application.

Using the following code under OSX 10.9 I get a scrambled results

Code: Select all

- (void)applicationDidFinishLaunching:(NSNotification *)notificationn {
    std::string mResourcePath = [[[NSBundle mainBundle] resourcePath] cStringUsingEncoding:NSUTF8StringEncoding];
    OGRE_NEW Ogre::LogManager();
    Ogre::Log * m_pLog = Ogre::LogManager::getSingleton().createLog("Ogre.log", true, true, false);
    mResourcePath = Ogre::macBundlePath() + "/Contents/Resources/";
    // Create a new root object with the correct paths
    Ogre::Root *mRoot = new Ogre::Root("", mResourcePath + "ogre.cfg");
    Ogre::StaticPluginLoader m_StaticPluginLoader;
    Ogre::RenderWindow* mWindow = mRoot->initialise(true);
    OgreView* ogreView;
    OgreWindow* ogreWindow;
    mWindow->getCustomAttribute("VIEW", &ogreView);
    mWindow->getCustomAttribute("WINDOW", &ogreWindow);
    Ogre::SceneManager *mSceneMgr = mRoot->createSceneManager(Ogre::ST_GENERIC, "My scene manager");
	// Add resource locations
    Ogre::ResourceGroupManager::getSingleton().addResourceLocation(mResourcePath,std::string("FileSystem"), Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
	// Create the camera, node & attach camera
    Ogre::Camera *mCamera = mSceneMgr->createCamera("My camera");
    Ogre::SceneNode *camNode = mSceneMgr->getRootSceneNode()->createChildSceneNode();
    // Create a light
    mSceneMgr->setAmbientLight(Ogre::ColourValue(1, 1, 1));
    // Add a object, give it it's own node
    Ogre::SceneNode *objectNode = mSceneMgr->getRootSceneNode()->createChildSceneNode();
    Ogre::Entity *knot = mSceneMgr->createEntity("knot", "knot.mesh");
    objectNode->setPosition(Ogre::Vector3(0, 0, -500));
    [window setContentView:ogreView];
    [window makeMainWindow];
Scambled Image
Scambled Image
scambled.png (120.57 KiB) Viewed 1335 times
However if I change the code to automatically generate the window rather than create it myself it works correctly

Code: Select all

    Ogre::NameValuePairList misc;
    misc["FSAA"] = "0";
    misc["FSAAH"] = "Quality";
    misc["contentScalingFactor"] = "1";
    misc["displayFrequency"] = "0";
    OgreView* view = [[OgreView alloc] initWithFrame:NSMakeRect(100,100,1024,768)];
    misc["macAPI"] = "cocoa";
    misc["externalWindowHandle"] = Ogre::StringConverter::toString((size_t)view);
    //misc["orientation"] = "Landscape Right";
    //m_pRenderWnd = m_pRoot->createRenderWindow("OgreWindow",1536,2048,true,&misc);
    Ogre::RenderWindow* mWindow = [view ogreWindow];
Working Image
Working Image
working.png (46.27 KiB) Viewed 1335 times
I originally thought it was one of the parameters I was passing in but I have double checked them by changing them in various combinations but I can not a working result. Does anyone know why this works when automatically generating the window but doesn't when it is created manually?

User avatar
OGRE Team Member
OGRE Team Member
Posts: 4270
Joined: Sun Feb 25, 2007 4:56 am
Location: Bloomington, MN
x 126

Re: Odd Rendering Behaviour on OSX 10.9 (Mavericks)

Post by masterfalcon »

I would recommend trying out the 1.9 branch for support on Mavericks. Of course, Apple may break something, but it should work for now at least.

Post Reply