Table of contents
- Resources And Materials
- Orienting An Object
- Exceptions and Asserts
- Debug To Release
- 1. Definitions
- 2. Fair Use Rights
- 3. License Grant
- 4. Restrictions
- 5. Representations, Warranties and Disclaimer
- 6. Limitation on Liability.
- 7. Termination
- 8. Miscellaneous
Why is my render window black?
- Way too many possibilities...start first with:
- Have you created a camera and a viewport? See Ogre demo code in createScene() methods for more...
- Have you set camera clip distances to some sane values?
- Are you trying to render a black cat on a black background?
- Do you have any lights set up (e.g. SceneManager::setAmbientLight)?
- If you are using multiple SceneManagers, did you populate the currently active scene graph (SceneManager) or another?
- If you are using the demo ExampleApplication framework, did you call startRendering()? Did you implement createScene()?
- If you are using a custom main loop, are you calling the host windowing system's message loop to allow its PAINT messages to fall through and be processed?
- Is your camera INSIDE a model you've placed in your scene? Try moving your camera backwards on the Z plane.
- If you previously broke up startRendering() into a custom main loop, do you still call renderOneFrame() on Ogre::Root?
Why does my dynamic lighting look all wrong?
- Check you have normals on your mesh
- Check they are pointing in the right direction (i.e. out of the model)
- If you have scaled any of the nodes the objects are attached to, note that this scaling distorts the size of the normals too. You should either avoid scaling dynamically lit objects (e.g. rescale them in the modeller instead), or use Entity::setNormaliseNormals() to compensate
Why don't areas behind transparent objects get rendered properly?
- Just blending through scene_blend isn't enough - you have to think about what happens with depth information. By default the rasteriser uses depth information to decide whether to render a pixel, so if your transparent object is updating the depth even in transparent areas, it will occlude objects rendered afterwards. If your material has partially transparent areas (not just fully solid or fully transparent), then you need to turn depth writing off for your transparent material (depth_write off in the pass section). If your material only has \hard\ alpha i.e. either 100% transparent or fully solid, then a more optimal setting is alpha_rejection, which rejects depth updates in transparent areas too.
Why does my animation not run?
- You have to call AnimationState::addTime() each frame to advance the animation. See the AnimationState::addTime() API reference for more
- You might have forgotten to turn it on using AnimationState::SetEnabled(true)
- Maybe it did run once at the start, you just didn't see it. Check if you are looping or not, if not: use AnimationState::SetLoop(true)
Why does my object display as white (or black) in Ogre?
- Check the Ogre.log that resides by default in your program's directory . It will contain information about the materials that were not found or could not be parsed for some reason.
- Make sure you place your materials either in the locations mentioned in resources.cfg, or, if assigning resource locations manually, make sure you add the location of the .material script using ResourceGroupManager::addResourceLocation()
- Make sure that you are calling ResourceGroupManager::initialiseAllResourceGroups() or ResourceGroupManager::initialiseResourceGroup() until you do, your materials, even if they are found, will neither be parsed or available, and you will get lines in Ogre.log asking you if you forgot to define a material.
Why does my resource creation or load fail in strange ways?
- Check you have created at least one render window before loading a resource. Both Direct3D and OpenGL need a primary window context and many aspects of resources cannot be loaded until there is a window.
- OgreCore.zip belongs to Ogre 1.6.0 and was removed in 2009 (It seems the mac and iphone versions of ogre still include it in the xcode templates).
- Add SdkTrays.zip to your resources config file (it's in media/packs).
What are the differences between lookAt(), setAutoTracking(), setDirection(), setOrientation()...
- setDirection() makes your node face parallel to a provided vector. You provide the vector, transform space (local, relative to parent or absolute), and the local axis with which to point (usually the negative Z axis).
- lookAt() uses setDirection(). It makes your node face a certain point. The difference is subtle. Picture object A at 100,100 and B at 90,10. B.lookAt(100,100) will point B at A. B.setDirection(100,100) will point it parallel to the line (0,0)-(100,100).
- setAutoTracking() means lookAt another node and keep looking at it, even if it moves.
- setOrientation() and rotate() are the most useful methods for orienting objects. They are discussed at length along with Quaternions in the Quaternion and Rotation Primer.
- See the API documentation on SceneNode for further details on the above functions.
My program is running too slow! (or takes a long time to shutdown)
- Debug vs Release
- You could be building it in 'Debug' mode. Debug mode enables a lot of checks and functions to help debug the code, but at the cost of processor overhead; when you are finished debugging the program, make sure you select 'Release' mode (on Windows systems, on Linux you should add -O3 to your compiler flags) so you can see it run at the proper speed. The difference is usually quite significant. One user reported a 400% difference.
- You may be using too many individual objects/submeshes. Graphics cards (GPU) like to have rendering queued into a relatively small number of large batches to operate at peak efficiency. If you use lots of small movable objects, especially if they are composed of multiple submeshes (each of which is its own render operation), the GPU underperforms because too much time is being spent in the overhead of setting up the individual rendering operations. This enqueueing process is done in the driver, which is constrained by the speed of the CPU, not the GPU. This presentation explains that 25000 batches per second will saturate (completely, on its own) a 1Ghz CPU. That means to maintain 60 FPS on a 1Ghz CPU you cannot issue more than about 416 batches per frame, where a batch is one instance of a submesh (for example). Of course, other factors may limit your performance earlier. You can improve batching by grouping static objects together in a StaticGeometry object, or by reducing the number of submeshes you use per mesh (do you really need that many different materials per mesh?).
Why does the camera 'lurch' regularly as I move?
- This appears to be an internal window timing issue which only happens at relatively low frame rates (<200) on D3D9 when you use windowed mode and don't use VSync. Turning on VSync, or switching to full screen (or indeed, using GL in any mode) resolves the problem, and you also won't see it at higher frame rates. If you suffer from this in windowed mode, just enable vsync to resolve the problem. In full screen you can continue to leave VSync disabled if you want.
My Ogre application builds fine, but when I run it I get an error saying it can't find OgreMain_d.dll. Help!
- Chances are you are running this in the debugger. How do I know? It's looking for the Debug build of the main Ogre DLL. If you are running your app in the Debugger (for instance, inside VisualStudio) then you need to set the Working Directory in your project's settings (under the Debugging tab in the project property sheet) to the location where your app resides. Visual C++ defaults to the location of the .vcproj project file for its working directory when running instances in the IDE. If you are running your app outside the IDE, you need either to have the path to OgreMain_d.dll (as well as the other Ogre DLLs and plugins) in your system PATH, or move the DLLs to where your application EXE resides.
Tips for setting up VisualStudio are here: Visual Studio Debugging Settings
Ogre Application throws Exception: Cannot find -Camera with name PlayerCam
- This is almost a sure sign that you need to build/rebuild Ogre, probably after a SVN update.
Ogre is debugging with Microsoft MFC, and Ogre Memory Manager keeps reporting Leakage assert...
- When Ogre's memory debug macro works with MFC's counterparts,they always got each other redefined. This makes OgreMemoryManager to report deallocate RAM that wasn't allocated by this memory manager — they are allocated by MFC debug routines. One Possible solution is to remove all MFC *define new DEBUG_NEW macros from your source code. The removal does no harm to your code because the Ogre Memory Manager works just as well as the MFC Memory Manager.
Each and every Ogre Application throws Run-Time Check Failure *0 - The value of ESP was not properly saved across a function call.
- This usually happens when rebuilding the Ogre source after a SVN update. Do a complete clean and build again. If this doesn't fix it, check that you are not loading any uncleaned addon plugins, like the DotSceneOctreeManager. Just comment it out in plugins.cfg.
I get an exception from the Cg plugin about not being able to find the image when launching the SampleBrowser or my own app on Mac OS X! What image is it talking about?
- This is actually NVIDIA's fault and seems to be something that they changed between Cg Toolkit 2.0 and 2.2. It's unclear on whether it is an intentional or accidental change. But anyways, OGRE looks for Cg.framework in the standard place which is MyApp.app/Contents/Frameworks/Cg.framework. The problem is that even if the framework is in the right place, information included in the framework when it was built says that it is somewhere else.
So if you are seeing errors like this: An exception has occurred: OGRE EXCEPTION(7:InternalErrorException): Could not load dynamic library Plugin_CgProgramManager. System Error: dlopen(//Path/To/Your/App/build/Debug/MyApp.app/Contents/Plugins/Plugin_CgProgramManager.dylib, 9): Library not loaded: @executable_path/../Library/Frameworks/Cg.framework/Cg Referenced from: /Path/To/Ogre/Source/build/bin/Debug/Plugin_CgProgramManager.dylib Reason: image not found in DynLib::load at /Path/To/Ogre/Source/OgreMain/src/OgreDynLib.cpp (line 91)
You will need to do this:
First, open Terminal.app and navigate to where your Cg framework is. Not the copy inside your application. It's possible that it could be in the Dependencies folder or /Library/Frameworks.
sudo install_name_tool -id @executable_path/../Frameworks/Cg.framework/Cg Cg.framework/Versions/1.0/Cg
sudo install_name_tool -change @executable_path/../Library/Frameworks/Cg.framework/Cg
You will be prompted for your administrator password so that the commands can make changes to the file. Note that unless NVIDIA changes this you may need to do it again if you upgrade to future versions of the Cg Toolkit.
D3D11 device can't create shader resource view
- Check the version of your used shader model:Direct3D 9 shaders can be designed using shader model 1, shader model 2 and shader model 3; Direct3D 10 shaders can only be designed on shader model 4. Direct3D 11 shaders can be designed on shader model 5.
Running application in debug mode is ok, but in release it crashes...
- If you're compiling your app for first time in release mode since a long time, then, you might have interest in this document Surviving the Release Version. Most important thing to remember is that Debug not only adds many checks but also initialize variables, something that release mode won't do for you. The common problems which occur when switching from debug to release mode and their solutions can be found in this article: Heap Corruption
Can I statically link OGRE?
How to deploy to Windows without an installation?
- You'll just need to transfer your game executable and any Ogre .dlls you're using (eg RenderSystem_GL.dll), your media and config files (by default, resources.cfg and plugins.cfg) and a copy of the Ogre license although this could be done in the form of an in-game message rather than a separate text file.
- If you use Visual Studio you will need to install the Visual C++ 2010 Redistributable package (x86, amd64) on the target machine before you start you application.
- If you use DirectX you will need to install the latest DirectX End-User Runtime on the target machine before you start you application. Normally you don't have to install DirectX because Windows install and update DirectX with the Windows Update Service.
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.