OGRE (Object-Oriented Graphics Rendering Engine)

Building new Plugins

http://www.ogre3d.org

Building New Plugins

If you want to customise the engine to add new features, but you don't want to do it in an application (say you want it to be reusable in binary form between projects, or maybe you just want to contribute to the engine without writing an actual application), you can write a plugin. Plugins do their work by calling the same interfaces an application can call - they can install new RenderSystem implementations, provide a SceneManager specialised for a particular scene type, add a new set of Controllers, whatever.

Plugins are built very much like applications - you link to OgreMain.lib and include the Ogre header files in your project. The only requirement is that you expose two methods from the dll you create:

dllStartPlugin: called when your plugin is loaded. Your plugin should create any classes, allocate memory, register with other Ogre objects etc. You should not assume that the RenderSystem has been initialised at this stage, it almost certainly has not been, so do not try to use the RenderSystem class or any class dependent on it (e.g. TextureManager). For instance, you could define a subclass of SceneManager in your dll and call Root::setSceneManager to provide your new implementation.

dllStopPlugin: called on shutdown of the Ogre system just before unloading your dll. Release any memory you allocated here.

You can use the Plugin_ParticleFX, RenderSystem_Direct3D7 and Plugin_BspSceneManager projects as examples of writing plugins for Ogre.

Back to Readme.html

Copyright © 2002 by The OGRE Team