Drawing in 2D space

A place for users of OGRE to discuss ideas and experiences of utilitising OGRE in their games / demos / applications.
daves
Goblin
Posts: 214
Joined: Fri Jan 20, 2006 3:35 pm

Drawing in 2D space

Post by daves »

We need to be able to draw certain information in screen space. In general this includes text and even simple graphics (e.g. lines, rectangles).

Our first attempt at drawing lines in screen space was to migrate to eihort and then use the enhanced ManualObject features that allow one to do just this.

Unfortunately the object created in this fashion still needs to be attached (or at least seems to need to be attached to the scene), and its visibility seems to be impacted by the visibility of the scene node that it is attached to.

Is there a way that we can leverage the screen space drawing ability within the ManualObject without attaching the object to the scene?
daves
Goblin
Posts: 214
Joined: Fri Jan 20, 2006 3:35 pm

Post by daves »

The problem we are seeing is that we've created a number of these 2D manual objects and drawn them. They draw fine... however if we move the camera slightly then the lines sometimes simply dissappear. They will come back if we "reset the camera" to the original position. Now we've attached these objects to a scene node that is VERY far away from the camera. Indeed its beyond the far clipping plane.

We dont want to have to attach them to a real scene object ... thats why we attached them to a distant "utility object" created just so that we can create these 2d manual objects.


Why would the lines sometimes show and sometimes not?
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 »

Did you ".setInfinite();" the BoundingBox of the SceneNode that holds the object(s).

greetings
my tweets | www.fuse-software.com | home of vektrix (Flash GUI for Ogre3D) and caspin (ActionScript 3 Virtual Machine Wrapper)
User avatar
sinbad
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 19269
Joined: Sun Oct 06, 2002 11:19 pm
Location: Guernsey, Channel Islands
x 67

Post by sinbad »

You actually need to do it on the object to ensure compatibility with all SceneManagers. I've done this before, here's the code I used:

Code: Select all

		mSelectBox = mgr->createManualObject(str.str());
		mgr->getRootSceneNode()->createChildSceneNode()->attachObject(mSelectBox);	
	Ogre::AxisAlignedBox aabb;
		aabb.setInfinite();
		mSelectBox->setBoundingBox(aabb);