This tutorial is based on the first one created to explain how Ogre3d 1.9 can be built statically in Mac OS X. You can find the first tutorial here: Building Ogre3D 1.9 Statically. The idea of this tutorial is to continue the previous work in order to render an Ogre Head inside a Window.

If you followed the previous tutorial, you should have the following two files:
CMakeLists.txt file:

PROJECT(tutorial1)

CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++ -std=c++11")

SET(OGRE_BASE_FOLDER "/opt/dev/ogre3d-1.9.0/")
SET(OGRE_INCLUDE_FOLDER "/opt/dev/ogre3d-1.9.0/build/sdk/include/OGRE")
SET(OGRE_LIB_FOLDER "/opt/dev/ogre3d-1.9.0/build/sdk/lib")

INCLUDE_DIRECTORIES(${OGRE_INCLUDE_FOLDER})
LINK_DIRECTORIES(${OGRE_LIB_FOLDER})

FILE(GLOB_RECURSE SRCS "${PROJECT_SOURCE_DIR}/src/*.cpp")
FILE(GLOB_RECURSE HDRS "${PROJECT_SOURCE_DIR}/src/*.h")

ADD_EXECUTABLE(${PROJECT_NAME} MACOSX_BUNDLE ${SRCS} ${HDRS})

TARGET_LINK_LIBRARIES(
${PROJECT_NAME}
${OGRE_LIB_FOLDER}/libOgreMainStatic.a
)

A main.cpp file:

#include <iostream>
#include <OgreString.h>

using namespace std;

int main()
{
    Ogre::String variable = "My first string using Ogre3D";
    cout << "Hello World: " << variable << endl;
    return 0;
}

Now the idea is to render a basic figure in our project. In order to do that, lets first include all the necessary libraries in our project. Change your CMakeLists.txt to look like this:

PROJECT(tutorial1)

CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++ -std=c++11")

FIND_LIBRARY(COCOA_LIB Cocoa)
IF(NOT COCOA_LIB)
    MESSAGE(FATAL_ERROR "Cocoa framework not found")
ELSE()
    MESSAGE(STATUS "Cocoa framework found. Location: " ${COCOA_LIB})
ENDIF()

FIND_LIBRARY(IOKIT_LIB IOKit)
IF(NOT IOKIT_LIB)
    MESSAGE(FATAL_ERROR "IOKit framework not found")
ELSE()
    MESSAGE(STATUS "IOKit framework found. Location: " ${IOKIT_LIB})
ENDIF()

FIND_LIBRARY(OPENGL_LIB OpenGL)
IF(NOT OPENGL_LIB)
    MESSAGE(FATAL_ERROR "OpenGL framework not found")
ELSE()
    MESSAGE(STATUS "OpenGL framework found. Location: " ${OPENGL_LIB})
ENDIF()

FIND_LIBRARY(AGL_LIB AGL)
IF(NOT AGL_LIB)
    MESSAGE(FATAL_ERROR "AGL framework not found")
ELSE()
    MESSAGE(STATUS "AGL framework found. Location: " ${AGL_LIB})
ENDIF()

MESSAGE(STATUS "Including project libraries")

INCLUDE_DIRECTORIES(/opt/1.9/ogre/build/sdk/include/OGRE)
LINK_DIRECTORIES(/opt/1.9/ogre/build/sdk/lib)

INCLUDE_DIRECTORIES(/opt/1.9/ogre/build/sdk/include/OGRE/RenderSystems/GL)
LINK_DIRECTORIES(/opt/1.9/ogre/build/sdk/lib)

INCLUDE_DIRECTORIES(/opt/1.9/ogre/build/sdk/include/OGRE/Plugins/ParticleFX)
LINK_DIRECTORIES(/opt/1.9/ogre/build/sdk/lib)

INCLUDE_DIRECTORIES(/opt/1.9/dependencies/include/OIS)
LINK_DIRECTORIES(/opt/1.9/dependencies/lib/Release)

INCLUDE_DIRECTORIES(/opt/1.9/dependencies/include/boost)
INCLUDE_DIRECTORIES(/opt/1.9/dependencies/include)
LINK_DIRECTORIES(/opt/1.9/dependencies/lib)

INCLUDE_DIRECTORIES(/opt/1.9/dependencies/include/boost)
LINK_DIRECTORIES(/opt/1.9/dependencies/lib)

INCLUDE_DIRECTORIES(/opt/1.9/dependencies/include/freetype)
LINK_DIRECTORIES(/opt/1.9/dependencies/lib/Release)

INCLUDE_DIRECTORIES(/opt/1.9/dependencies/include/zzip)
LINK_DIRECTORIES(/opt/1.9/dependencies/lib/Release)

INCLUDE_DIRECTORIES(/opt/1.9/dependencies/include)
LINK_DIRECTORIES(/opt/1.9/dependencies/lib/Release)

INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}/src)
INCLUDE_DIRECTORIES(/opt/1.9/ogre/OgreMain/include/OSX)

FILE(GLOB_RECURSE SRCS "${PROJECT_SOURCE_DIR}/src/*.cpp")
FILE(GLOB_RECURSE HDRS "${PROJECT_SOURCE_DIR}/src/*.h")
FILE(GLOB RESOURCES_FOLDER ${PROJECT_SOURCE_DIR}/Resources)

ADD_EXECUTABLE(${PROJECT_NAME} MACOSX_BUNDLE ${SRCS} ${HDRS})

TARGET_LINK_LIBRARIES(
${PROJECT_NAME}
${COCOA_LIB}
${IOKIT_LIB}
${OPENGL_LIB}
${AGL_LIB}
/opt/1.9/ogre/build/sdk/lib/libOgreMainStatic.a
/opt/1.9/ogre/build/sdk/lib/libRenderSystem_GLStatic.a
/opt/1.9/ogre/build/sdk/lib/libPlugin_ParticleFXStatic.a
/opt/1.9/dependencies/lib/libboost_system.a
/opt/1.9/dependencies/lib/libboost_thread.a
/opt/1.9/dependencies/lib/Release/libOIS.a
/opt/1.9/dependencies/lib/Release/libfreetype.a
/opt/1.9/dependencies/lib/Release/libzziplib.a
/opt/1.9/dependencies/lib/Release/libFreeImage.a
)

# Change the hardcoded name of the project here:
FILE(COPY ${RESOURCES_FOLDER} DESTINATION ${PROJECT_SOURCE_DIR}/build/tutorial1.app/Contents)

Changes:

  • From line 6-32: Added basic frameworks (From the Apple page: "Frameworks is a hierarchical directory that encapsulates shared resources, such as a dynamic shared library, nib files, image files, localized strings, header files, and reference documentation in a single package."), including: Cocoa (graphical user interface), IOKit (inner core stuff for the the OS X platform), OpenGL (2D & 3D graphics), AGL (Apple Graphics Library).
  • From line 36-62: Including the projects libraries. You may not need all of them but usually for a basic Ogre3D project you will need them. Feel free to remove those that you don't need.
  • Line 68: You need to create a folder called Resources in you project's main folder, right next to the src folder. This folder will include the resources that the application (the bundle) file will need. This line copies the Resources folder from your project to the app bundle.

Your project's files structure should look like this:

/opt/dev/ogreprojects/tutorial1 $>ls -l
total 64
 8 -rw-r--r--  1 USER  wheel   2910 Jan 31 22:50 CMakeLists.txt
32 -rw-r--r--  1 USER  wheel  12289 Jan 31 22:49 CMakeLists.txt.user
 0 drwxr-xr-x  2 USER  wheel     68 Jan 31 22:53 Resources
 0 drwxr-xr-x  9 USER  wheel    306 Dec 11 19:50 build
 0 drwxr-xr-x  3 USER  wheel    102 Dec 11 20:34 src

Now, run the CMake command from Build menu in QtCreator. After that Run your application. Everything should be working fine; in the Application Output window in QtCreator, you get this message:

Starting /opt/dev/ogreprojects/tutorial1/build/tutorial1.app/Contents/MacOS/tutorial1...
/opt/dev/ogreprojects/tutorial1/build/tutorial1.app/Contents/MacOS/tutorial1 exited with code 0

And if you go the application bundle directory you should see the Resources folder:

/opt/dev/ogreprojects/tutorial1/build $>cd tutorial1.app/Contents
/opt/dev/ogreprojects/tutorial1/build/tutorial1.app/Contents $>ls -l
total 8
-rw-r--r--  1 USER  wheel  986 Jan 31 23:09 Info.plist
drwxr-xr-x  3 USER  wheel  102 Jan 31 23:09 MacOS
drwxr-xr-x  2 USER  wheel   68 Jan 31 23:09 Resources

Now add two files called application.h and application.cpp inside the src folder. The content of those files is this:
application.h:

#ifndef APPLICATION_H
#define APPLICATION_H

namespace Ogre
{
    class Root;
    class RenderWindow;
    class RenderSystem;
    class SceneManager;
}

class Application
{
public:
    Application();
    ~Application();

    void startApplication();
    void loadPlugins();
    bool setRenderSystem();
    void initializeRenderSystem();
    void createRenderWindow();
    void initializeResources();
    void parseResourceFileConfiguration();
    void createAndSetTheScene();

private:
    Ogre::Root *root;

};

#endif // APPLICATION_H

application.cpp:

#include "application.h"

#include <OgreRoot.h>

Application::Application() : root( 0 )
{
}

Application::~Application()
{
    if( root )
    {
        delete root;
    }
}

void Application::startApplication()
{
    root = new Ogre::Root( Ogre::StringUtil::BLANK );
}

Edit the main.cpp file to this:

#include <OgreException.h>
#include "application.h"

int main()
{
    Application application;
    try
    {
        application.startApplication();
    }catch( Ogre::Exception &e )
    {
        std::cerr << "An exception has occured: " << e.getFullDescription() << std::endl;
    }
    return 0;
}

Compile and Run the project; in the Application Output window in QtCreator you should see:

Starting /opt/dev/ogreprojects/tutorial1/build/tutorial1.app/Contents/MacOS/tutorial1...
Creating resource group General
Creating resource group Internal
Creating resource group Autodetect
SceneManagerFactory for type 'DefaultSceneManager' registered.
Registering ResourceManager for type Material
Registering ResourceManager for type Mesh
Registering ResourceManager for type Skeleton
MovableObjectFactory for type 'ParticleSystem' registered.
ArchiveFactory for archive type FileSystem registered.
ArchiveFactory for archive type Zip registered.
ArchiveFactory for archive type EmbeddedZip registered.
DDS codec registering
FreeImage version: 3.15.3
This program uses FreeImage, a free, open source image library supporting all common bitmap formats. See http://freeimage.sourceforge.net for details
Supported formats: bmp,ico,jpg,jif,jpeg,jpe,jng,koa,iff,lbm,mng,pbm,pbm,pcd,pcx,pgm,pgm,png,ppm,ppm,ras,tga,targa,tif,tiff,wap,wbmp,wbm,psd,cut,xbm,xpm,gif,hdr,g3,sgi,exr,j2k,j2c,jp2,pfm,pct,pict,pic,3fr,arw,bay,bmq,cap,cine,cr2,crw,cs1,dc2,dcr,drf,dsc,dng,erf,fff,ia,iiq,k25,kc2,kdc,mdc,mef,mos,mrw,nef,nrw,orf,pef,ptx,pxn,qtk,raf,raw,rdc,rw2,rwl,rwz,sr2,srf,srw,sti
Registering ResourceManager for type HighLevelGpuProgram
Registering ResourceManager for type Compositor
MovableObjectFactory for type 'Entity' registered.
MovableObjectFactory for type 'Light' registered.
MovableObjectFactory for type 'BillboardSet' registered.
MovableObjectFactory for type 'ManualObject' registered.
MovableObjectFactory for type 'BillboardChain' registered.
MovableObjectFactory for type 'RibbonTrail' registered.
*-*-* OGRE Initialising
*-*-* Version 1.9.0 (Ghadamon)
*-*-* OGRE Shutdown
Unregistering ResourceManager for type Compositor
Unregistering ResourceManager for type Skeleton
Unregistering ResourceManager for type Mesh
Unregistering ResourceManager for type HighLevelGpuProgram
Unregistering ResourceManager for type Material
/opt/dev/ogreprojects/tutorial1/build/tutorial1.app/Contents/MacOS/tutorial1 exited with code 0

Before continuing, there are two things to do first:

  • Copy the resources.cfg file located in the path:
/opt/dev/ogre3d-1.9.0/build/bin/resources.cfg

inside the Resources folder of your project.

  • Copy the Media folder located in the path:
/opt/dev/ogre3d-1.9.0/build/sdk/Media

inside the Resources folder of your project.

 Note
The Media folder includes some files that you may not need right now (this was done for the sake of brevity). Among these files you can find the ogre head materials and mesh.

Now let's add more code to the Application class in order to render the Ogre head:

__application.h__

#ifndef APPLICATION_H
#define APPLICATION_H

namespace Ogre
{
    class Root;
    class RenderWindow;
    class SceneManager;
    class Camera;
}

class Application
{
public:
    Application();
    ~Application();

    void startApplication();
    void loadPlugins();
    void setRenderSystem();
    void initializeRenderSystem();
    void createRenderWindow();
    void parseResourceFileConfiguration();
    void initializeResources();

    void createAndSetTheScene();

private:
    Ogre::Root *root;
    Ogre::RenderWindow* renderWindow;
    Ogre::SceneManager* sceneManager;
    Ogre::Camera* camera;
};

#endif // APPLICATION_H

application.cpp

#include "application.h"

#include <OgreRoot.h>
#include <OgreGLPlugin.h>
#include <OgreParticleFXPlugin.h>
#include <OgreConfigFile.h>
#include <OgreCamera.h>
#include <OgreViewport.h>
#include <OgreSceneManager.h>
#include <OgreRenderWindow.h>
#include <OgreEntity.h>
#include <macUtils.h>

Application::Application() : root( 0 )
{
}

Application::~Application()
{
    if( root )
    {
        delete root;
    }
}

void Application::startApplication()
{
    root = new Ogre::Root( Ogre::StringUtil::BLANK );

    loadPlugins();
    setRenderSystem();
    initializeRenderSystem();
    createRenderWindow();
    parseResourceFileConfiguration();
    initializeResources();

    createAndSetTheScene();

    root->startRendering();
}

void Application::loadPlugins()
{
    // Set the render system. In this case OpenGL
    Ogre::GLPlugin* gLPlugin = new Ogre::GLPlugin();
    root->installPlugin( gLPlugin );

    Ogre::ParticleFXPlugin *particleFXPlugin = new Ogre::ParticleFXPlugin();
    root->installPlugin( particleFXPlugin );
}

void Application::setRenderSystem()
{
    const Ogre::RenderSystemList &renderSystemList = root->getAvailableRenderers();
    if( renderSystemList.size() == 0 )
    {
        throw Ogre::Exception(Ogre::Exception::ERR_RENDERINGAPI_ERROR, "Sorry, no rendersystem was found.", __FILE__);
    }

    Ogre::RenderSystem *lRenderSystem = renderSystemList[ 0 ];
    Ogre::String renderSystemName = lRenderSystem->getName();
    Ogre::LogManager::getSingleton().logMessage( "Render System found: " + renderSystemName, Ogre::LML_NORMAL );
    root->setRenderSystem( lRenderSystem );
}

void Application::initializeRenderSystem()
{
    bool createAWindowAutomatically = false;
    Ogre::String windowTitle = "";
    Ogre::String customCapacities = "";
    root->initialise( createAWindowAutomatically, windowTitle, customCapacities );

}

void Application::createRenderWindow()
{
    Ogre::String windowTitle = "Tutorial 1";
    unsigned int windowSizeX = 800;
    unsigned int WindowSizeY = 600;
    bool isFullscreen = false;

    Ogre::NameValuePairList additionalParameters;
    additionalParameters[ "FSAA" ] = "0";
    additionalParameters["VSync"]="No";
    additionalParameters["macAPICocoaUseNSView"] = "true";
    additionalParameters["FSAAH"] = "Quality";
    additionalParameters["contentScalingFactor"] = "1";
    additionalParameters["displayFrequency"] = "0";
    additionalParameters[ "macAPI" ] = "cocoa";

    renderWindow = root->createRenderWindow( windowTitle, windowSizeX, WindowSizeY, isFullscreen, &additionalParameters );
}

void Application::initializeResources()
{
    // Set default mipmap level (note: some APIs ignore this)
    Ogre::TextureManager::getSingleton().setDefaultNumMipmaps( 5 );
    Ogre::ResourceGroupManager::getSingleton().initialiseAllResourceGroups();
}

void Application::parseResourceFileConfiguration()
{
    // set up resources and load resource paths from config file
    Ogre::String resourcesConfigurationPath = Ogre::macBundlePath() + "/Contents/Resources/resources.cfg";
    Ogre::ConfigFile configurationFile;
    configurationFile.load( resourcesConfigurationPath );

    // Go through all sections & settings in the resource file
    Ogre::ConfigFile::SectionIterator sectionNameIterator = configurationFile.getSectionIterator();
    Ogre::String sectionNameOfTheResource;
    Ogre::String typeNameOfTheResource;
    Ogre::String absolutePathToTheResource;

    while( sectionNameIterator.hasMoreElements() )
    {
        sectionNameOfTheResource = sectionNameIterator.peekNextKey();
        Ogre::ConfigFile::SettingsMultiMap *settings = sectionNameIterator.getNext();
        Ogre::ConfigFile::SettingsMultiMap::iterator i;
        for( i = settings->begin(); i != settings->end(); ++i )
        {
            typeNameOfTheResource = i->first;
            absolutePathToTheResource = i->second;
            Ogre::ResourceGroupManager::getSingleton().addResourceLocation( absolutePathToTheResource, typeNameOfTheResource, sectionNameOfTheResource );
        }
    }

    const Ogre::ResourceGroupManager::LocationList genLocs = Ogre::ResourceGroupManager::getSingleton().getResourceLocationList("General");
    absolutePathToTheResource = Ogre::macBundlePath() + "/Contents/Resources/Media";
    typeNameOfTheResource = "FileSystem";
    sectionNameOfTheResource = "Popular";

    // Add locations for supported shader languages
    if(Ogre::GpuProgramManager::getSingleton().isSyntaxSupported("glsles"))
    {
        Ogre::ResourceGroupManager::getSingleton().addResourceLocation(absolutePathToTheResource + "/materials/programs/GLSLES", typeNameOfTheResource, sectionNameOfTheResource);
    }
    else if(Ogre::GpuProgramManager::getSingleton().isSyntaxSupported("glsl"))
    {
        if(Ogre::GpuProgramManager::getSingleton().isSyntaxSupported("glsl150"))
        {
            Ogre::ResourceGroupManager::getSingleton().addResourceLocation(absolutePathToTheResource + "/materials/programs/GLSL150", typeNameOfTheResource, sectionNameOfTheResource);
        }
        else
        {
            Ogre::ResourceGroupManager::getSingleton().addResourceLocation(absolutePathToTheResource + "/materials/programs/GLSL", typeNameOfTheResource, sectionNameOfTheResource);
        }

        if(Ogre::GpuProgramManager::getSingleton().isSyntaxSupported("glsl400"))
        {
            Ogre::ResourceGroupManager::getSingleton().addResourceLocation(absolutePathToTheResource + "/materials/programs/GLSL400", typeNameOfTheResource, sectionNameOfTheResource);
        }
    }
    else if(Ogre::GpuProgramManager::getSingleton().isSyntaxSupported("hlsl"))
    {
        Ogre::ResourceGroupManager::getSingleton().addResourceLocation(absolutePathToTheResource + "/materials/programs/HLSL", typeNameOfTheResource, sectionNameOfTheResource);
    }
#		ifdef OGRE_BUILD_PLUGIN_CG
    Ogre::ResourceGroupManager::getSingleton().addResourceLocation(absolutePathToTheResource + "/materials/programs/Cg", typeNameOfTheResource, sectionNameOfTheResource);
#		endif

#		ifdef INCLUDE_RTSHADER_SYSTEM
    if(Ogre::GpuProgramManager::getSingleton().isSyntaxSupported("glsles"))
    {
        Ogre::ResourceGroupManager::getSingleton().addResourceLocation(absolutePathToTheResource + "/RTShaderLib/GLSLES", typeNameOfTheResource, sectionNameOfTheResource);
    }
    else if(Ogre::GpuProgramManager::getSingleton().isSyntaxSupported("glsl"))
    {
        Ogre::ResourceGroupManager::getSingleton().addResourceLocation(absolutePathToTheResource + "/RTShaderLib/GLSL", typeNameOfTheResource, sectionNameOfTheResource);
        if(Ogre::GpuProgramManager::getSingleton().isSyntaxSupported("glsl150"))
        {
            Ogre::ResourceGroupManager::getSingleton().addResourceLocation(absolutePathToTheResource + "/RTShaderLib/GLSL150", typeNameOfTheResource, sectionNameOfTheResource);
        }
    }
    else if(Ogre::GpuProgramManager::getSingleton().isSyntaxSupported("hlsl"))
    {
        Ogre::ResourceGroupManager::getSingleton().addResourceLocation(absolutePathToTheResource + "/RTShaderLib/HLSL", typeNameOfTheResource, sectionNameOfTheResource);
    }
#			ifdef OGRE_BUILD_PLUGIN_CG
    Ogre::ResourceGroupManager::getSingleton().addResourceLocation(absolutePathToTheResource + "/RTShaderLib/Cg", typeNameOfTheResource, sectionNameOfTheResource);
#			endif
#		endif // include_rtshader_system
}

void Application::createAndSetTheScene()
{
    sceneManager = root->createSceneManager(Ogre::ST_GENERIC);
    sceneManager->setAmbientLight( Ogre::ColourValue( 0.5, 0.5, 0.5 ) );

    camera = sceneManager->createCamera("PlayerCam");
    camera->setPosition(0, 0, 120);
    camera->setNearClipDistance( 5 );

    Ogre::Viewport* viewPort = renderWindow->addViewport( camera );
    viewPort->setBackgroundColour( Ogre::ColourValue( 0, 0, 0 ) );
    camera->setAspectRatio( Ogre::Real( viewPort->getActualWidth() ) / Ogre::Real( viewPort->getActualHeight() ) );

    // Create an Entity
    Ogre::Entity* ogreHead = sceneManager->createEntity("Head", "ogrehead.mesh");

    // Create a SceneNode and attach the Entity to it
    Ogre::SceneNode* headNode = sceneManager->getRootSceneNode()->createChildSceneNode("HeadNode");
    headNode->attachObject(ogreHead);

    // Create a Light and set its position
    Ogre::Light* light = sceneManager->createLight("MainLight");
    light->setPosition(20.0f, 80.0f, 50.0f);
}

The explanation about the previous code won't be covered here because you can find it (with more detail) in the Tutorials section. Take a look at these tutorials: Basic Tutorial 1 and Basic Mesh Loading. Now rebuild the project and run it. You should see something like this:
Ogre window showing the ogre head

 Note
When you change something in the Resources folder or anything that will end up in the project's app bundle. First delete the app bundle of your build folder and then rebuild your project. This forces QtCreator to recreate the new app bundle with the updated Resources folder information.

Final Thoughts

Now that you're able to create a project in QtCreator using CMake and Ogre3D, you are now ready to continue with the tutorials (Ogre3D's Tutorials). Additionally you should take care of the following:

  • Most of the tutorials in the Wiki use the Ogre3D's SDK (which is compiled dynamically) or the Ogre3D project compiled dynamically (not statically like this tutorial). So, anytime a tutorial mentions that you should use a special plugin (remember that plugins are loaded in a different way when Ogre3D has been compiled statically) load it just like it appears in the Application::loadPlugins() method in the code above.
  • If you're having trouble including any framework (via the CMakeLists.txt configuration file) to your project, try to include it in the following way:
FIND_LIBRARY(COCOA_FRAMEWORK_PATH
    NAMES Cocoa
    PATHS /System/Library
    PATH_SUFFIXES Frameworks
    NO_DEFAULT_PATH)
IF(NOT COCOA_FRAMEWORK_PATH)
    MESSAGE(FATAL_ERROR "Cocoa framework not found")
ELSE()
    MESSAGE(STATUS "Cocoa framework found. Path: " ${COCOA_FRAMEWORK_PATH})
ENDIF()
  • The render loop in Mac OS X cannot be done in the traditional way (the way it's explained in the tutorials - using a while render loop). The reason is this (I'm quoting form one of the forum posts):
"Cocoa dispatches events differently than Carbon or Win32. You don't pump messages, instead you wait for them to be delivered to you. If you are running a never ending loop for rendering and events handling, your app never has a chance for those events to be delivered to it. Which is why it is hanging. Check out SampleBrowser_OSX.h to see an example of using renderOneFrame with Cocoa."

You can find more information in the following posts:

Okay, that's it. If you have any doubt please consult the forum (Ogre3D Forum).

<HR>
Creative Commons Copyright -- Some rights reserved.


THE WORK (AS DEFINED BELOW) IS PROVIDED UNDER THE TERMS OF THIS CREATIVE COMMONS PUBLIC LICENSE ("CCPL" OR "LICENSE"). THE WORK IS PROTECTED BY COPYRIGHT AND/OR OTHER APPLICABLE LAW. ANY USE OF THE WORK OTHER THAN AS AUTHORIZED UNDER THIS LICENSE OR COPYRIGHT LAW IS PROHIBITED.

BY EXERCISING ANY RIGHTS TO THE WORK PROVIDED HERE, YOU ACCEPT AND AGREE TO BE BOUND BY THE TERMS OF THIS LICENSE. THE LICENSOR GRANTS YOU THE RIGHTS CONTAINED HERE IN CONSIDERATION OF YOUR ACCEPTANCE OF SUCH TERMS AND CONDITIONS.

1. Definitions

  • "Collective Work" means a work, such as a periodical issue, anthology or encyclopedia, in which the Work in its entirety in unmodified form, along with a number of other contributions, constituting separate and independent works in themselves, are assembled into a collective whole. A work that constitutes a Collective Work will not be considered a Derivative Work (as defined below) for the purposes of this License.
  • "Derivative Work" means a work based upon the Work or upon the Work and other pre-existing works, such as a translation, musical arrangement, dramatization, fictionalization, motion picture version, sound recording, art reproduction, abridgment, condensation, or any other form in which the Work may be recast, transformed, or adapted, except that a work that constitutes a Collective Work will not be considered a Derivative Work for the purpose of this License. For the avoidance of doubt, where the Work is a musical composition or sound recording, the synchronization of the Work in timed-relation with a moving image ("synching") will be considered a Derivative Work for the purpose of this License.
  • "Licensor" means the individual or entity that offers the Work under the terms of this License.
  • "Original Author" means the individual or entity who created the Work.
  • "Work" means the copyrightable work of authorship offered under the terms of this License.
  • "You" means an individual or entity exercising rights under this License who has not previously violated the terms of this License with respect to the Work, or who has received express permission from the Licensor to exercise rights under this License despite a previous violation.
  • "License Elements" means the following high-level license attributes as selected by Licensor and indicated in the title of this License: Attribution, ShareAlike.

2. Fair Use Rights

Nothing in this license is intended to reduce, limit, or restrict any rights arising from fair use, first sale or other limitations on the exclusive rights of the copyright owner under copyright law or other applicable laws.

3. License Grant

Subject to the terms and conditions of this License, Licensor hereby grants You a worldwide, royalty-free, non-exclusive, perpetual (for the duration of the applicable copyright) license to exercise the rights in the Work as stated below:

  • to reproduce the Work, to incorporate the Work into one or more Collective Works, and to reproduce the Work as incorporated in the Collective Works;
  • to create and reproduce Derivative Works;
  • to distribute copies or phonorecords of, display publicly, perform publicly, and perform publicly by means of a digital audio transmission the Work including as incorporated in Collective Works;
  • to distribute copies or phonorecords of, display publicly, perform publicly, and perform publicly by means of a digital audio transmission Derivative Works.
  • For the avoidance of doubt, where the work is a musical composition:
    • Performance Royalties Under Blanket Licenses. Licensor waives the exclusive right to collect, whether individually or via a performance rights society (e.g. ASCAP, BMI, SESAC), royalties for the public performance or public digital performance (e.g. webcast) of the Work.
    • Mechanical Rights and Statutory Royalties. Licensor waives the exclusive right to collect, whether individually or via a music rights society or designated agent (e.g. Harry Fox Agency), royalties for any phonorecord You create from the Work ("cover version") and distribute, subject to the compulsory license created by 17 USC Section 115 of the US Copyright Act (or the equivalent in other jurisdictions).
    • Webcasting Rights and Statutory Royalties. For the avoidance of doubt, where the Work is a sound recording, Licensor waives the exclusive right to collect, whether individually or via a performance-rights society (e.g. SoundExchange), royalties for the public digital performance (e.g. webcast) of the Work, subject to the compulsory license created by 17 USC Section 114 of the US Copyright Act (or the equivalent in other jurisdictions).


The above rights may be exercised in all media and formats whether now known or hereafter devised. The above rights include the right to make such modifications as are technically necessary to exercise the rights in other media and formats. All rights not expressly granted by Licensor are hereby reserved.

4. Restrictions

The license granted in Section 3 above is expressly made subject to and limited by the following restrictions:

  • You may distribute, publicly display, publicly perform, or publicly digitally perform the Work only under the terms of this License, and You must include a copy of, or the Uniform Resource Identifier for, this License with every copy or phonorecord of the Work You distribute, publicly display, publicly perform, or publicly digitally perform. You may not offer or impose any terms on the Work that alter or restrict the terms of this License or the recipients' exercise of the rights granted hereunder. You may not sublicense the Work. You must keep intact all notices that refer to this License and to the disclaimer of warranties. You may not distribute, publicly display, publicly perform, or publicly digitally perform the Work with any technological measures that control access or use of the Work in a manner inconsistent with the terms of this License Agreement. The above applies to the Work as incorporated in a Collective Work, but this does not require the Collective Work apart from the Work itself to be made subject to the terms of this License. If You create a Collective Work, upon notice from any Licensor You must, to the extent practicable, remove from the Collective Work any credit as required by clause 4(c), as requested. If You create a Derivative Work, upon notice from any Licensor You must, to the extent practicable, remove from the Derivative Work any credit as required by clause 4(c), as requested.
  • You may distribute, publicly display, publicly perform, or publicly digitally perform a Derivative Work only under the terms of this License, a later version of this License with the same License Elements as this License, or a Creative Commons iCommons license that contains the same License Elements as this License (e.g. Attribution-ShareAlike 2.5 Japan). You must include a copy of, or the Uniform Resource Identifier for, this License or other license specified in the previous sentence with every copy or phonorecord of each Derivative Work You distribute, publicly display, publicly perform, or publicly digitally perform. You may not offer or impose any terms on the Derivative Works that alter or restrict the terms of this License or the recipients' exercise of the rights granted hereunder, and You must keep intact all notices that refer to this License and to the disclaimer of warranties. You may not distribute, publicly display, publicly perform, or publicly digitally perform the Derivative Work with any technological measures that control access or use of the Work in a manner inconsistent with the terms of this License Agreement. The above applies to the Derivative Work as incorporated in a Collective Work, but this does not require the Collective Work apart from the Derivative Work itself to be made subject to the terms of this License.
  • If you distribute, publicly display, publicly perform, or publicly digitally perform the Work or any Derivative Works or Collective Works, You must keep intact all copyright notices for the Work and provide, reasonable to the medium or means You are utilizing: (i) the name of the Original Author (or pseudonym, if applicable) if supplied, and/or (ii) if the Original Author and/or Licensor designate another party or parties (e.g. a sponsor institute, publishing entity, journal) for attribution in Licensor's copyright notice, terms of service or by other reasonable means, the name of such party or parties; the title of the Work if supplied; to the extent reasonably practicable, the Uniform Resource Identifier, if any, that Licensor specifies to be associated with the Work, unless such URI does not refer to the copyright notice or licensing information for the Work; and in the case of a Derivative Work, a credit identifying the use of the Work in the Derivative Work (e.g., "French translation of the Work by Original Author," or "Screenplay based on original Work by Original Author"). Such credit may be implemented in any reasonable manner; provided, however, that in the case of a Derivative Work or Collective Work, at a minimum such credit will appear where any other comparable authorship credit appears and in a manner at least as prominent as such other comparable authorship credit.

5. Representations, Warranties and Disclaimer

UNLESS OTHERWISE AGREED TO BY THE PARTIES IN WRITING, LICENSOR OFFERS THE WORK AS-IS AND MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND CONCERNING THE MATERIALS, EXPRESS, IMPLIED, STATUTORY OR OTHERWISE, INCLUDING, WITHOUT LIMITATION, WARRANTIES OF TITLE, MERCHANTIBILITY, FITNESS FOR A PARTICULAR PURPOSE, NONINFRINGEMENT, OR THE ABSENCE OF LATENT OR OTHER DEFECTS, ACCURACY, OR THE PRESENCE OF ABSENCE OF ERRORS, WHETHER OR NOT DISCOVERABLE. SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION OF IMPLIED WARRANTIES, SO SUCH EXCLUSION MAY NOT APPLY TO YOU.

6. Limitation on Liability.

EXCEPT TO THE EXTENT REQUIRED BY APPLICABLE LAW, IN NO EVENT WILL LICENSOR BE LIABLE TO YOU ON ANY LEGAL THEORY FOR ANY SPECIAL, INCIDENTAL, CONSEQUENTIAL, PUNITIVE OR EXEMPLARY DAMAGES ARISING OUT OF THIS LICENSE OR THE USE OF THE WORK, EVEN IF LICENSOR HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.

7. Termination

  • This License and the rights granted hereunder will terminate automatically upon any breach by You of the terms of this License. Individuals or entities who have received Derivative Works or Collective Works from You under this License, however, will not have their licenses terminated provided such individuals or entities remain in full compliance with those licenses. Sections 1, 2, 5, 6, 7, and 8 will survive any termination of this License.
  • Subject to the above terms and conditions, the license granted here is perpetual (for the duration of the applicable copyright in the Work). Notwithstanding the above, Licensor reserves the right to release the Work under different license terms or to stop distributing the Work at any time; provided, however that any such election will not serve to withdraw this License (or any other license that has been, or is required to be, granted under the terms of this License), and this License will continue in full force and effect unless terminated as stated above.

8. Miscellaneous

  • Each time You distribute or publicly digitally perform the Work or a Collective Work, the Licensor offers to the recipient a license to the Work on the same terms and conditions as the license granted to You under this License.
  • Each time You distribute or publicly digitally perform a Derivative Work, Licensor offers to the recipient a license to the original Work on the same terms and conditions as the license granted to You under this License.
  • If any provision of this License is invalid or unenforceable under applicable law, it shall not affect the validity or enforceability of the remainder of the terms of this License, and without further action by the parties to this agreement, such provision shall be reformed to the minimum extent necessary to make such provision valid and enforceable.
  • No term or provision of this License shall be deemed waived and no breach consented to unless such waiver or consent shall be in writing and signed by the party to be charged with such waiver or consent.
  • This License constitutes the entire agreement between the parties with respect to the Work licensed here. There are no understandings, agreements or representations with respect to the Work not specified here. Licensor shall not be bound by any additional provisions that may appear in any communication from You. This License may not be modified without the mutual written agreement of the Licensor and You.