OpenSceneGraph vs. OGRE.

Anything and everything that's related to OGRE or the wider graphics field that doesn't fit into the other forums.
User avatar
vgmdev
Greenskin
Posts: 110
Joined: Tue Feb 08, 2005 2:58 am
Location: MI, USA

Post by vgmdev »

:D That fine with we. I’m not saying any thing bad about ogre.
I just don’t really like osgproducer.

What do you think about the namespaces?
http://www.openscenegraph.org/documenta ... paces.html

User avatar
sinbad
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 19265
Joined: Sun Oct 06, 2002 11:19 pm
Location: Guernsey, Channel Islands
x 66
Contact:

Post by sinbad »

Well, I said I wouldn't comment on organisation, since it's a subjective thing. Whatever works for you is right.

But to give you the reason why I don't use lots of namespaces in C++ - I take a different approach to namespaces in C++ than I do when I'm using Java, since Java makes multiple namespaces a lot tidier to use. In Java, namespace imports can be quite specific, e.g. to particular classes, meaning complex and numerous namespaces are simple. In C++ you don't have much choice - it's either the sledgehammer 'using namespace' or the potentially cluttering Prefix:: usage everywhere, which IMO makes using lots of namespaces cumbersome. That's why we only have one - Ogre:: - to avoid namespace clashes. Separation otherwise is provided by plugin boundaries, since those generally don't add to the API anyway (it's all abstracted).

User avatar
vgmdev
Greenskin
Posts: 110
Joined: Tue Feb 08, 2005 2:58 am
Location: MI, USA

Post by vgmdev »

ah... :mrgreen:

User avatar
DWORD
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 1365
Joined: Tue Sep 07, 2004 12:43 pm
Location: Aalborg, Denmark
Contact:

Post by DWORD »

sinbad wrote:In Java, namespace imports can be quite specific, e.g. to particular classes, meaning complex and numerous namespaces are simple. In C++ you don't have much choice - it's either the sledgehammer 'using namespace' or the potentially cluttering Prefix:: usage everywhere, which IMO makes using lots of namespaces cumbersome.
Not that I advocate using more namespaces, I really like that Ogre has only one, but isn't importing specific classes possible in C++, too? AFAIK you can write e.g.

Code: Select all

using std::vector;
(MSDN, using Declaration)

User avatar
sinbad
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 19265
Joined: Sun Oct 06, 2002 11:19 pm
Location: Guernsey, Channel Islands
x 66
Contact:

Post by sinbad »

You know, I was actually thinking that afterward - and on checking you're right. I've never actually seen this used, and I'm not sure I would use it because of the typing involved. Luckily Eclipse handles all the specific importing for me with Java (and keeps them organised, removing unused ones), I just guide it concerning which ones I'm using if there's ambiguity. So maybe it's a tool issue more than anything. Still, best to keep things as simple as possible I think.

User avatar
DWORD
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 1365
Joined: Tue Sep 07, 2004 12:43 pm
Location: Aalborg, Denmark
Contact:

Post by DWORD »

sinbad wrote:Still, best to keep things as simple as possible I think.
I agreee completely. I don't think I've seen it used anywhere either really, except for some STL documentation samples.

SteveFrazier
Kobold
Posts: 29
Joined: Sun Sep 05, 2004 10:44 pm
Location: Rochester Hills, MI

Post by SteveFrazier »

You can also use namespace aliases:

Code: Select all

namespace mynamespace::subspace = subspace;

subspace::class myobj();
Boost uses these in some of the test programs.

Just my 2c.[/code]

Post Reply