Can not draw a 3d line

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
sunzhuo
Posts: 17
Joined: Tue Dec 23, 2008 2:14 am
Location: Nagoya

Can not draw a 3d line

Post by sunzhuo »

I am using 1.5. This issue made me crazy. I tested it in the helloword example. It doesn't work. see below:

Code: Select all

	smgr->addCameraSceneNode(0, vector3df(0,30,-40), vector3df(0,5,0));

    SMaterial m;
    m.Lighting = false;
    driver->setMaterial(m);
    driver->setTransform(video::ETS_WORLD, core::matrix4()); 
	driver->draw3DLine(vector3df(-100,5,0),vector3df(100,5,0),video::SColor(255,255,255,255));
Sylence
Posts: 725
Joined: Sat Mar 03, 2007 9:01 pm
Location: Germany
Contact:

Post by Sylence »

Doesn't work means what ?
Is the line drawn wrong, or is it not drawn?
Software documentation is like sex. If it's good you want more. If it's bad it's better than nothing.
sunzhuo
Posts: 17
Joined: Tue Dec 23, 2008 2:14 am
Location: Nagoya

Post by sunzhuo »

Sylence wrote:Doesn't work means what ?
Is the line drawn wrong, or is it not drawn?
means not drawn, can not be seen, invisible
Acki
Posts: 3496
Joined: Tue Jun 29, 2004 12:04 am
Location: Nobody's Place (Venlo NL)
Contact:

Post by Acki »

how/when do you call it ???
it works for me this way:

Code: Select all

SMaterial m;
m.Lighting = false;
while(device->run()){
  driver->beginScene(true, true, video::SColor(0,0,0,0));
  smgr->drawAll();
  guienv->drawAll();

  driver->setMaterial(m);
  driver->setTransform(video::ETS_WORLD, core::matrix4());
  driver->draw3DLine(vector3df(-100,5,10),vector3df(100,5,10));

  driver->endScene();
}
while(!asleep) sheep++;
IrrExtensions:Image
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
sunzhuo
Posts: 17
Joined: Tue Dec 23, 2008 2:14 am
Location: Nagoya

Post by sunzhuo »

Acki wrote:how/when do you call it ???
it works for me this way:

Code: Select all

SMaterial m;
m.Lighting = false;
while(device->run()){
  driver->beginScene(true, true, video::SColor(0,0,0,0));
  smgr->drawAll();
  guienv->drawAll();

  driver->setMaterial(m);
  driver->setTransform(video::ETS_WORLD, core::matrix4());
  driver->draw3DLine(vector3df(-100,5,10),vector3df(100,5,10));

  driver->endScene();
}
I call it before the loop.
randomMesh
Posts: 1186
Joined: Fri Dec 29, 2006 12:04 am

Post by randomMesh »

sunzhuo wrote:I call it before the loop.
That's wrong. You need to call it between

Code: Select all

driver->beginScene()
and

Code: Select all

driver->endScene()
sunzhuo
Posts: 17
Joined: Tue Dec 23, 2008 2:14 am
Location: Nagoya

Post by sunzhuo »

randomMesh wrote:
sunzhuo wrote:I call it before the loop.
That's wrong. You need to call it between

Code: Select all

driver->beginScene()
and

Code: Select all

driver->endScene()
I got it, thanks.
Post Reply