Page 1 of 1

Can not draw a 3d line

Posted: Thu Jan 08, 2009 1:39 pm
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));

Posted: Thu Jan 08, 2009 1:49 pm
by Sylence
Doesn't work means what ?
Is the line drawn wrong, or is it not drawn?

Posted: Thu Jan 08, 2009 1:52 pm
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

Posted: Thu Jan 08, 2009 2:00 pm
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();
}

Posted: Thu Jan 08, 2009 2:29 pm
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.

Posted: Thu Jan 08, 2009 3:00 pm
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()

Posted: Thu Jan 08, 2009 3:05 pm
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.