Table of contents
- Comparison with other engines
- I'm getting a FileLoadException when I try to run a Mogre app on another machine
- Why do I get a crash when I dispose Root ?
- I get a crash, how can I see the line and the call stack ?
- I get a System.BadImageFormatException within a 64-bit enviroment, what's wrong ?
- Set VC# 2008 Express to compile in x86
- 1. Definitions
- 2. Fair Use Rights
- 3. License Grant
- 4. Restrictions
- 5. Representations, Warranties and Disclaimer
- 6. Limitation on Liability.
- 7. Termination
- 8. Miscellaneous
- After you have created your scene there is no performance hit at all (since it's a wrapper). There is probably lower performance when creating objects since you got additional layer .Net ↔ Ogre but it is so small that it's unnoticeable. Also when you are using listeners you have to pass throught this layer. I would go with Mogre your application will never have a bottleneck on a .Net ↔ Ogre layer. answer by user koirat
- The core library is still the same Ogre. The difference to Mogre is, that the applications uses C++/CLI wrapper code for the Ogre API. Only the access between the C# application and the Ogre core needs wrapping effort. For Ogre internal work (like rendering) there is no wrapper disturbing. Also I read that C++/CLI should be very fast. The question could be how much performance the rest of your application needs. Maybe a C++ application environment is faster than a C# one. If the rest of your application needs not much CPU power, then this fact doesn't matter. answer by user Beauty
Mogre is only a very small layer over Ogre so there's not much to debug (except maybe for the Mogre's pure .NET classes). It's far more interesting to step into Ogre's sources with a debugger. To be able to do so, the following requirements must be met:
- You need debug builds for Ogre and Mogre. The safest way to get them is to compile Mogre yourself.
- In the project settings of your Mogre (.NET) project enable "Enable unmanaged code debugging" in the "Debug" section.
Note: When unmanaged code debugging is enable starting a debug process needs more time.
Found in this forum thread.
It also contains a further discussion, e.g. about Axiom, XNA.
- Unity costs $1200 if you want the un-gimped engine, which is a pretty big expense for a hobby project and a large deterrent to recruiting others to help on the project, so I suspect Unity is not a viable choice despite the fact that it has a good pipeline.
- Unity also has a somewhat strange dev environment where you attach "scripts" to visual objects. While this works, it also makes me shudder to think what a large-scale project will look like over time and how disorganized it would become.
- Visual 3d.Net, while less costly than Unity, is still not free, thus again is a barrier to recruitment
- I was initially excited about using this, despite the cost, however, as I kept waiting and waiting for their promised next version, I began to realize that the engine seems to be in trouble and I cannot rely on them to come out with features that I need in any kind of reasonable time frame. Disappointingly, I've mostly given up on this engine - which is too bad considering how much potential it has.
- cost is not free, but low enough that I think it's reasonable for a hobby project
- Theoretically has everything I need/want... however, based on reading it seems the current version is virtually unsupported and buggy as hell. It's also a nightmare to work with based on my trial with it. The devs are supposedly re-vamping Torque X, but with the plans I've read, I don't expect real results for another 1-2 years at least.
Found in this forum post.
- Indie version is free (however don't know if one can create commersial application with it), pro version is expensive.
- pro: can script with javascipt / C#
- con: indie version does not have all the good things that pro version have.
- pro: reads .x files
- pro: good physic engine and easy link objects to physics etc
- pro: uses angelscript, C -like scripting language
- con: loading objects to the editor, it is complicated
- con: shadowing system sucks
- con: not open source, so cant modify it the way I wanted (can ask if developer to add new feature but it costs money)
Blender 3D game engine:
- pro: integrated to blender, so modelling can be done quick, and these are in game engine immediately
- pro: physics, quite easy setup
- con: using fonts isnt made easy
- con: cant use with commersial applications, because of that blend player's license, and it cant be sold with own blender game
- pro: reads .blend files
- pro: physics, sounds etc works, that are setuped in blender
- con: does not support all of the blender's game engine's logic
- con: scripting with LUA (arggg!! I dont like lua/python scripting languages, too hard and complicated to me, and I have no time to learn new programming language from the start)
- Of course one can use ogrekit and code all in c++ but I dont want use it anymore either
- Then I tried some other game engine but always noticed that there arent free.
- Then I installed java, netbeans, and downloaded jMe (JavaMonkeyEngine). It have own editor, modified netbeans. It doesn't work very well yet, it and newer jme is at alpha stage. Then I thinked twise, that no more java. When used C#, there is no point turning to java again.
- Then I switched back to Mogre and good things: C#, Ogre have good community so project does not die (hopefully mogre does not die either). One thing that I miss, is cross-platform support, but it isnt so necassary atm (for my projects).
These are not classes but structs; they offer better performance and put no pressure on the managed heap. They are mainly used for simple Ogre classes that are like C structs (they don't form inheritance chains and they mostly contain data). .NET structs are fundamentally different than classes and are used differently, so '_NativePtr' is appended so you can clearly distinguish them.
_NativePtr structs contain and pass around only the native pointer to the Ogre object. The guidelines for using them are:
- Instantiation - When you 'new' a struct it's members get their default values, thus when you new a _NativePtr struct you get a null native pointer. In order to create an Ogre object you have to call the static Create method:
LayerBlendModeEx_NativePtr lbm_null = new LayerBlendModeEx_NativePtr(); // This returns a null native pointer LayerBlendModeEx_NativePtr lbm_obj = LayerBlendModeEx_NativePtr.Create(); // This creates the Ogre object and returns a pointer to it
- Comparing - If you want to compare whether two _NativePtr objects refer to the same Ogre object use the Equals method. Note that _NativePtr structs override the Equals method and the '==' operator if the Ogre class overrides the '==' operator:
LayerBlendModeEx_NativePtr lbm1 = LayerBlendModeEx_NativePtr.Create(); LayerBlendModeEx_NativePtr lbm2 = LayerBlendModeEx_NativePtr.Create(); bool areEqual1 = lbm1.NativePtr == lbm2.NativePtr; // They point to different objects, returns false bool areEqual2 = lbm1.Equals(lbm2); // Ogre::LayerBlendModeEx overrides '==' to compare the values, returns true bool areEqual3 = lbm1 == lbm2; // You can use '==' instead of Equals, returns true
- Destroying - If you create a _NativePtr object, you must call the DestroyNativePtr when you are finished with it, in order to delete the native Ogre object, otherwise there will be a memory leak (you can track memory leaks by using the debug Mogre.dll and checking 'OgreLeaks.log')
lbm1.DestroyNativePtr(); // Delete the Ogre object
This is only for classes that wrap STL containers (vector, list etc.). C++ uses the 'const' keyword to indicate that a parameter will not be modified by the method, or that the returned value should not be modified by the calling code. C# and VB.NET doesn't have a similar mechanism so, to avoid breaking the method 'contract', when a Ogre method accepts/returns a const STL container, the equivelant Mogre method accepts/returns a read-only 'Const_' STL wrapper class. The conversion from the normal STL wrapper to the Const_ one is implicit:
NameValuePairList list = new NameValuePairList(); Const_NameValuePairList const_list = list; // Implicit conversion
Note: This implicit conversion doesn't work for VB.NET (probably a VB.NET bug). Use the ReadOnlyInstance property instead:
Dim const_list As Const_NameValuePairList = list.ReadOnlyInstance
Classes that are used with multiple inheritance by Ogre are converted to interfaces. For example, if there is an Ogre method that accepts/returns a Ogre::Renderable object, it will accept/return a Mogre.IRenderable when converted for Mogre. So when dealing with Ogre objects/methods you will use the interface.
But if you want to create a custom class that implements the interface, you can't just add it to the class definition; you will implement it on the .NET side but it won't be usable by Ogre. For these cases there is a class that you should derive from if you want to implement the interface. For example, in order to implement IRenderable, you should subclass the Renderable class.
MOGRE is built using Visual Studio 8 SP1, so it requires the VC SP1 libraries. You need to install the SP1 vcredist_x86 on the target machine. (Note: vcredist_x86 installs only the release libraries, so only the release binaries of Mogre will work.) Also, take a look at this post.
- If you are getting a crash only when using the OpenGL renderer and not with the Direct3D renderer, make sure that you are not disposing Root inside a finalizer. GL requires that it gets disposed by the same thread that created it, and finalizers run in a different thread than the main one.
- All SharedPtr objects (MaterialPtr, TexturePtr, GpuProgramPtr etc.) must be out of scope before disposing Root, so make sure that you clear all references of SharedPtr objects before the call (i.e. set your SharedPtr variables to null).
- Copy the 'OgreMain_d.pdb' file from 'C:\OgreSDK\lib' to your executable's debug directory (i.e. 'C:\OgreSDK\bin\debug')
- Go to your project's properties -> Debug and under 'Debug' Configuration check 'Enable unmanaged code debugging'.
- Debug your project and when the crash happens you should be able to see the call stack. If you download Mogre's source code you'll be able to select the source file to see what line is causing it.
- Note that to get the full stack trace, you must be linked to Mogre_d.dll in your .NET project (and the _d versions of any Mogre DLLs you link to), and in turn for that to work you must make sure your plugins.cfg refers to the _d versions of all the plugin DLLs. If you have done all of the above, you should be able to get a stack trace all the way into Ogre C++ code.
The MOGRE assemblies are platform-specific and therefore generate some strange errors if you build them with standard Visual Studio settings within an 64-bit enviroment. You can force your application (eg. the samples) to run in WOW64 by going to the project properties in VS, select the "build" tab, and set the "platform target" to x86.
(Info provided by Lightbringer)
This looks like a scary long list, but it's really simple.
- In VC# Express 2005, go to Tools -> Options.
- In the bottom-left corner of the Options dialog, check the box that says, "Show all settings".
- In the tree-view on the left hand side, select "Projects and Solutions".
- In the options on the right, check the box that says, "Show advanced build configuraions."
- Click OK.
- Go to Build -> Configuration Manager...
- In the Platform column next to your project, click the combobox and select "<New...>".
- In the "New platform" setting, choose "x86".
- Click OK.
- Click Close.
Thanks very much to http://forums.xna.com/forums/t/4377.aspx#22601.
Working in Windows 7 64bits.
Set your system so that it uses the 32bit CLR by-default (use this if the previous tip is not working)
If running in a 64bits Windows system, you can try to set your system so that it uses the 32bit CLR by-default. You can do this by calling:
- Open a Command Prompt window with Administration rights
- "C:\WINDOWS\Microsoft.NET\Framework64\v2.0.50727\Ldr64.exe setwow"
- try to run your MOGRE app
Working in Windows 7 64bits RTM.
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.
- "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.
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.
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.
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.
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.
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.
- 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.
- 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.