Page 1 of 1

Odd Rendering Behaviour on OSX 10.9 (Mavericks)

Posted: Mon Sep 23, 2013 10:10 am
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 1333 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 1333 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?

Re: Odd Rendering Behaviour on OSX 10.9 (Mavericks)

Posted: Tue Sep 24, 2013 4:50 pm
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.