Any Inbuild Functions to Draw Coordinate Axis?

Anything and everything that's related to OGRE or the wider graphics field that doesn't fit into the other forums.
User avatar
hga17
Kobold
Posts: 38
Joined: Thu Mar 01, 2007 10:33 am

Any Inbuild Functions to Draw Coordinate Axis?

Post by hga17 »

Hi All,

Is there some sample code to draw coordinate axises in orge? Any inbuild functions to do that?

I think it would be helpful to have one. What do you think about it?

Best regards,

Chris
User avatar
Frenetic
Bugbear
Posts: 806
Joined: Fri Feb 03, 2006 7:08 am

Post by Frenetic »

I believe there is an axis.mesh included with Ogre.

If that isn't what you're looking for, you can make your own axis in a few lines of code with ManualObject.

Here's how I make axes (this one is 40 units in size):

Code: Select all

	mAxis = mSceneMgr->createManualObject("MyAxis");
	mAxis->begin( "AxisMaterial", Ogre::RenderOperation::OT_LINE_LIST );
	mAxis->position(10,0,0);
	mAxis->colour(1,0,0);
	mAxis->position(40,0,0);
	mAxis->position(0,10,0);
	mAxis->colour(0,1,0);
	mAxis->position(0,40,0);
	mAxis->position(0,0,10);
	mAxis->colour(0,0,1);
	mAxis->position(0,0,40);
	mAxis->end();
In case you need it, the material script for AxisMaterial:

Code: Select all

material AxisMaterial
{
	technique
	{
		pass
		{
			lighting off
			ambient 1 1 1
		}
	}
}
Although BaseWhiteNoLighting might work too.

Hope this helps! :)
User avatar
hga17
Kobold
Posts: 38
Joined: Thu Mar 01, 2007 10:33 am

Post by hga17 »

Hi Frenetic,

Thank you very much for reply!

However, axis.mesh is not part of my ogre sdk. I use window find utility but cannot find it at all. Can you or someone who see this reply please give me a copy of this mesh (together with material if any)?

My email is HelloGao@hotmail.com


Thanks

Best regards,

Chris
Estrich
Halfling
Posts: 79
Joined: Fri Mar 31, 2006 7:51 pm
Location: Linz, Austria

Post by Estrich »

I think what Frenetic was refering to is the "axes.mesh" which should be included in your ogre distribution in the OgreCore.zip package - that's why you couldn't find it with the search I guess.
User avatar
Klaim
Old One
Posts: 2565
Joined: Sun Sep 11, 2005 1:04 am
Location: Paris, France
x 56

Post by Klaim »

I asked the same question on the chat yesterday, we found that Ogre::SceneManager::setDisplaySceneNodes should do the trick but :

1) it asks for ressources that are in OgreCore.zip, instead of buiding it itself...
2) it don't seem to do anything (at least in OctreeSceneManager ) ;

It seem deprecated.... but it shouldn't...
User avatar
Samir
Halfling
Posts: 59
Joined: Sat Jun 25, 2005 12:11 pm

Post by Samir »

I'm using Ogre::SceneManager::setDisplaySceneNodes and it works fine for me but I'm using the PagingLandscapeSceneManager.
User avatar
stoneCold
OGRE Expert User
OGRE Expert User
Posts: 867
Joined: Fri Oct 01, 2004 9:13 pm
Location: Carinthia, Austria
x 1

Post by stoneCold »

Samir wrote:I'm using Ogre::SceneManager::setDisplaySceneNodes and it works fine for me but I'm using the PagingLandscapeSceneManager.
Browsed the ogre core yesterday (while talking with Klaim) and it seems that PLSM2 implements the function, but none of the basic scenemanagers does.
Might be worth a patch, though I don't know if this function is just thought to be overridden by inheriting scenemanagers, but it seems like it is.
my tweets | www.fuse-software.com | home of vektrix (Flash GUI for Ogre3D) and caspin (ActionScript 3 Virtual Machine Wrapper)
User avatar
Samir
Halfling
Posts: 59
Joined: Sat Jun 25, 2005 12:11 pm

Post by Samir »

stoneCold wrote: it seems that PLSM2 implements the function
Yes, and actually, it used to be buggy in PLSM2 more than a year ago and I was the one that requested it to be fixed, so I guess I made it survive all these years :D (see http://www.ogre3d.org/phpBB2addons/view ... highlight=)
stoneCold wrote: but none of the basic scenemanagers does.
That's a shame, it is really useful for debuging rotation and such.
stoneCold wrote: Might be worth a patch,
You're absolutely right.
stoneCold wrote: though I don't know if this function is just thought to be overridden by inheriting scenemanagers, but it seems like it is.
I don't think it is, I think I remember using it in other SceneManagers before I switched to PLSM2 (which was more than a year ago)
User avatar
hga17
Kobold
Posts: 38
Joined: Thu Mar 01, 2007 10:33 am

Post by hga17 »

Hi All,

Thank you very much for all of your help!
I really appreciate that.

Special thanks to Estrich, your information is very helpful for a beginner.

Thanks!

Best regards,

Chris
User avatar
Yaraher
Greenskin
Posts: 142
Joined: Tue Dec 13, 2005 11:37 pm
Location: Lima, Peru

Post by Yaraher »

Maybe we are still on time to add this function to the Einhort release, only if this function was just forgotten or something like that and not meant to be added only on other scene managers; if that's the case, then it's not an issue :P
User avatar
gerds
Goblin
Posts: 260
Joined: Mon Sep 01, 2003 3:59 am
Location: London, United Kingdom
x 1

Post by gerds »

Cheers Frenetic, I added that code to my engine to allow the content guys to toggle the axis on and off. Very useful :D
aldric
Gnoblar
Posts: 4
Joined: Thu Feb 17, 2022 2:16 pm

Re:

Post by aldric »

Frenetic wrote: Tue Mar 20, 2007 7:02 am

I believe there is an axis.mesh included with Ogre.

If that isn't what you're looking for, you can make your own axis in a few lines of code with ManualObject.

Here's how I make axes (this one is 40 units in size):

Code: Select all

	mAxis = mSceneMgr->createManualObject("MyAxis");
	mAxis->begin( "AxisMaterial", Ogre::RenderOperation::OT_LINE_LIST );
	mAxis->position(10,0,0);
	mAxis->colour(1,0,0);
	mAxis->position(40,0,0);
	mAxis->position(0,10,0);
	mAxis->colour(0,1,0);
	mAxis->position(0,40,0);
	mAxis->position(0,0,10);
	mAxis->colour(0,0,1);
	mAxis->position(0,0,40);
	mAxis->end();

In case you need it, the material script for AxisMaterial:

Code: Select all

material AxisMaterial
{
	technique
	{
		pass
		{
			lighting off
			ambient 1 1 1
		}
	}
}

Although BaseWhiteNoLighting might work too.

Hope this helps! :)

hello, this is a long time since you posted this quite interesting answer, well sorry for the post scavanging and may be my english. Well your method to draw axes works well, beside colors... lines stay white... I am currently trying to use this to make xyz grid... but i need colors and i do not understand why it's white. Could you help me, please. If you need some code please feel free to ask

loath
Platinum Sponsor
Platinum Sponsor
Posts: 294
Joined: Tue Jan 17, 2012 5:18 am
x 67

Re: Any Inbuild Functions to Draw Coordinate Axis?

Post by loath »

have you tried modifying the material color values?