OgreNewt Minimal Simple Application Project

From Newton Wiki
Jump to: navigation, search

Introduction

This article is for anyone getting started with OgreNewt and to those finding that the samples provided by OgreNewt are somewhat hard to follow because they use the Ogre samples framework and have their code spread across many files and folders. The target of Minimal OgreNewt Application project is to provide the simplest possible working OgreNewt application.

Features

  • Very small codebase in a couple of files
  • Easy to follow installation guide
  • Visual Studio 9 project files available
  • Does not require modifying project files (uses enviroment variables)
  • Does not use Ogre sample framework
  • Implements
    • Simple first person camera
    • Debugging graphics
    • Mouse and keyboard input
    • Picking


Get it


Install it

1. Get Ogre

  • http://www.ogre3d.org/
  • Get precompiled libraries
  • Or compile yourself
  • Set enviroment variable "OGRE_HOME" to ogre home directory
    • for example "C:\Ogre3D"
    • includes will be searched in $(OGRE_HOME)\OgreMain\include


2. Get latest Boost C++ libraries

  • http://www.boost.org/
  • Just install anywhere
  • Set enviroment variable "BOOST_HOME" to boost directory
    • for example "C:\Boost"


3. Get Newton Game Dynamics

  • http://newtondynamics.com/forum/
    • there is a "Newton 2 BETA" link at the top, this may change in the future, but you'll find it
  • Install it
  • Set enviroment variable "NEWTON_HOME" to install directory
    • for example "C:\NDG\2.10"


4. Get OgreNewt

  • Latest can be downloaded from SVN at https://svn.ogre3d.org/svnroot/ogreaddons/branches/ogrenewt/newton20
    • you can't download from this url using your browser, you need to use SVN client
    • for example, use GUI SVN client TortoiseSVN (http://tortoisesvn.tigris.org/)
    • google how to use it, basically just download and istall it, make a folder for ogrenewt, right click the folder, choose "SVN Checkout...", enter the SVN url above and do the checkout.
  • The OgreNewt Visual studio project is a bit messed up, you can use the one that comes with this project in "ogrenewt" directory. Just copy the solution and project files to the folder you checked out ogrenewt, overwrite existing files and open the solution. The modified project uses the enviroment variables you defined above so everything should compile without any changes to the project (may not be the case if you did not compile Ogre yourself, you might have to change the include and library directories).
  • Set enviroment variable "OGRENEWT_HOME" to OgreNewt root directory
    • for example "C:\Ogre3D\Addons\OgreNewt"


5. Copy DLLs

  • If everything is set up right, the dll's will be automaticly copied to the right location, if not:
    • Copy OgreMain.dll, Plugin_CgProgramManager.dll, Plugin_OctreeSceneManager.dll, RenderSystem_Direct3D9.dll, RenderSystem_GL.dll from OGRE_HOME\lib directory to this projects' root directory
    • Copy OgreMain_d.dll, Plugin_CgProgramManager_d.dll, Plugin_OctreeSceneManager_d.dll, RenderSystem_Direct3D9_d.dll, RenderSystem_GL_d.dll from OGRE_HOME\lib directory to this projects' root directory if you also want to use debug mode
    • Copy cg.dll and OIS.dll from OGRE_HOME\Samples\Common\bin\Release (and OIS_d.dll from OGRE_HOME\Samples\Common\bin\Debug for debug) to project root directory
    • Copy newton.dll from NEWTON_HOME\sdk\x32\dll_vs9 to project root directory
    • Copy OgreNewt.dll (and OgreNewt_d.dll for debug) from OGRENEWT_HOME\lib to project root directory


6. Compile the application

  • Open NGD.sln, choose Release or Debug configuration and hit Compile (F7)
  • Release configuration compiles to release.exe and debug to.. you guessed it, debug.exe
  • If I got this tutorial right and you did everything correctly, it should compile out of the box and work!


7. Experiment

  • The code provided is pretty much the minimum for a working application with input and debugging
  • No Ogre sample framework is used
  • The code has not been organised to great depth to make the learning curve simpler. You can modify it to use better organization, state managment and so on.


Discuss it

See the forum thread: http://www.ogre3d.org/addonforums/viewtopic.php?f=4&t=11671