OGRE Wiki
Support and community documentation for Ogre3D
Ogre Forums
ogre3d.org
Log in
Username:
Password:
CapsLock is on.
Remember me (for 1 year)
Log in
Home
Tutorials
Tutorials Home
Basic Tutorials
Intermediate Tutorials
Mad Marx Tutorials
In Depth Tutorials
Older Tutorials
External Tutorials
Cookbook
Cookbook Home
CodeBank
Snippets
Experiences
Ogre Articles
Libraries
Libraries Home
Alternative Languages
Assembling A Toolset
Development Tools
OGRE Libraries
List of Libraries
Tools
Tools Home
DCC Tools
DCC Tutorials
DCC Articles
DCC Resources
Assembling a production pipeline
Development
Development Home
Roadmap
Building Ogre
Installing the Ogre SDK
Setting Up An Application
Ogre Wiki Tutorial Framework
Frequently Asked Questions
Google Summer Of Code
Help Requested
Ogre Core Articles
Community
Community Home
Projects Using Ogre
Recommended Reading
Contractors
Wiki
Immediate Wiki Tasklist
Wiki Ideas
Wiki Guidelines
Article Writing Guidelines
Wiki Styles
Wiki Page Tracker
Ogre Wiki Help
Ogre Wiki Help Overview
Help - Basic Syntax
Help - Images
Help - Pages and Structures
Help - Wiki Plugins
Toolbox
Freetags
Categories
List Pages
Structures
Trackers
Statistics
Rankings
List Galleries
Ogre Lexicon
Comments
History: Talk:Singleton
View page
Source of version: 1
(current)
Wouldn't it be more appropriate to describe Ogre's Singleton implementation? It differs significantly. ((User:Tanis|tanis)) 04:39, 11 Jan 2005 (MST) {DL()} That would be a good idea, I have no information on that unfortunately so someone else would have to do it (in the wiki spirit :) ) ((User:Bana|bana)) 19:32, 11 Jan 2005 (MST) {DL()} I've added a section about it. ((User:Tanis|tanis)) 23:06, 11 Jan 2005 (MST) {DL} {DL} The assert fails because sm_Singleton is still 0; Should it be like this or is there a better solution? ~pp~ MyManager* MyManager::getSingletonPtr(void) { if( !ms_Singleton ) ms_Singleton = new MyManager(); return ms_Singleton; } ~/pp~ No, not better, just different. As I wrote in the article: Ogre's approach wants to make the construction explicit. Two main advantages. First it allows to use constructors with arguments. Second it coerces you to think about when and where it is initialized. Without explicit construction you sooner or later don't know anymore which singleton is initialized when. ((User:Tanis|tanis)) 22:41, 16 Mar 2005 (CET) There's also another problem with "normal" singleton implementations. The order of initialization for the singletons can't be properly controlled (it is undefined), and the singletons can't be dynamically created / destroyed / recreated. The implementation Ogre uses is taken from Game Programming Gems I, and is originally written by Scott Bilas (think so at least). This implemtation is used in other places as well, an example being Gabber. ((User:Mangetsu|Mangetsu)) 16:00, 8 November 2005 (CST)
Search by Tags
Search Wiki by Freetags
Latest Changes
IDE Eclipse
FMOD SoundManager
HDRlib
Building Ogre V2 with CMake
Ogre 2.1 FAQ
Minimal Ogre Collision
Artifex Terra
OpenMB
Advanced Mogre Framework
MogreSocks
...more
Search
Find
Advanced
Search Help
Online Users
141 online users