<html> <head> <title>OGRE Building New Plugins</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><STYLE TYPE="text/css"> <!-- .MainHeader { font-weight: bold; color: #FFFF33; background-color: #006600; font-size: 10pt} body { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10pt; color: #CCFFCC; background-color: #003300} .BorderHeader { background-color: #999900; font-size: 8pt; font-weight: bold; color: #333300; text-align: center} .MainContent { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10pt; color: #CCFFCC } .BorderContent { font-size: 8pt; color: #66CC33; border-color: black #666600 #666600; padding-top: 2px; padding-right: 2px; padding-bottom: 10px; padding-left: 2px; margin-bottom: 2px; border-style: solid; border-top-width: 0px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px} a:link { color: #FFFF00; text-decoration: underline} a:hover { color: #FFFFFF; text-decoration: underline} a:visited { color: #FFCC66; text-decoration: underline} li { color: #66CC33; list-style-type: circle; position: relative; left: -15px; clip: rect( )} .NewsDate { color: #CCFFCC; font-weight: bold} td { font-size: 10pt} th { font-size: 10pt} .Annotation { font-size: 10px} H1 { text-align: center; } A.qindex {} A.qindexRef {} A.el { text-decoration: none; font-weight: bold } A.elRef { font-weight: bold } A.code { text-decoration: none; font-weight: normal; color: #4444ee } A.codeRef { font-weight: normal; color: #4444ee } DL.el { margin-left: -1cm } DIV.fragment { width: 100%; border: none; background-color: #003300 } DIV.ah { background-color: black; margin-bottom: 3; margin-top: 3 } TD.md { background-color: #006600 } DIV.groupHeader { margin-left: 16; margin-top: 12; margin-bottom: 6; font-weight: bold } DIV.groupText { margin-left: 16; font-style: italic; font-size: smaller } FONT.keyword { color: #008000 } FONT.keywordtype { color: #999920 } FONT.keywordflow { color: #e0FF00 } FONT.comment { color: #009900 } FONT.preprocessor { color: #809020 } FONT.stringliteral { color: #002080 } FONT.charliteral { color: #008080 } H3 { FONT-FAMILY: trebuchet ms,helvetica,arial } .ex { FONT-SIZE: 8pt; FONT-FAMILY: tahoma } CODE.keywordtype { COLOR: #00ccff } CODE.keyword { FONT-WEIGHT: bold; COLOR: #00ccff } CODE.fn { COLOR: white; FONT-WEIGHT: bold; } CODE.var { COLOR: #dcdcdc; } CODE.macro { COLOR: #809020; FONT-WEIGHT: bold; } CODE.comm { COLOR: lime } CODE.num { COLOR: purple } CODE.str { COLOR: #ffcc33; font-style: italic } .SectionHeader { font-size: 14px; color: #FFFFCC; font-weight: bold} .header { font-size: 16px; font-weight: bold; color: #FFFFCC} --> </STYLE> </head> <body bgcolor="#FFFFFF" text="#000000"> <p align="center" class="header">OGRE (Object-Oriented Graphics Rendering Engine)</p><P ALIGN="center" CLASS="header">Building new Plugins</P><P ALIGN="center" CLASS="header"><A HREF="http://www.ogre3d.org">http://www.ogre3d.org</A></P><P CLASS="MainHeader">Building New Plugins</P><P>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.</P><P>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:</P><P> <B>dllStartPlugin</B>: 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.</P><P><B>dllStopPlugin</B>: called on shutdown of the Ogre system just before unloading your dll. Release any memory you allocated here.</P><P>You can use the Plugin_ParticleFX, RenderSystem_Direct3D7 and Plugin_BspSceneManager projects as examples of writing plugins for Ogre.</P><P CLASS="MainHeader"> </P><P CLASS="MainContent" ALIGN="CENTER"><A HREF="../ReadMe.html">Back to Readme.html</A></P><P CLASS="MainContent" ALIGN="LEFT">Copyright © 2002 by The OGRE Team<BR /> <SCRIPT TYPE="text/javascript"> <!--//hide script from old browsers document.write( "Last modified "+ document.lastModified ); //end hiding contents --> </SCRIPT> </P> </body> </html>