[SOLVED] draw3DLine not working

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
AlfAlien
Posts: 20
Joined: Tue Jan 28, 2014 2:08 pm

[SOLVED] draw3DLine not working

Post by AlfAlien »

I need to draw line in 3d (white line on black background). I use OpenGL driver. Similar function that draws 2d line works great, but draw3DLine doesn't work.

Code: Select all

 
    while(device->run())
    {
        driver->beginScene(true, true, video::SColor(255,0,0,0));
        driver->draw3DLine(core::vector3df(0, 0, 0), core::vector3df(100, 100, 100)); //not working
        //driver->draw2DLine(core::position2d<s32>(0,0), core::position2d<s32>(100,100)); //working
        driver->endScene();
    }
 
What's wrong?
Last edited by AlfAlien on Wed Mar 05, 2014 12:58 pm, edited 1 time in total.
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: draw3DLine not working

Post by CuteAlien »

Explanation in the doc's: http://irrlicht.sourceforge.net/docu/cl ... 3a4eebb5e6
(you have to set material and transformation - it's not done automatically because you usually only do that once and then draw lot's of lines).
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
AlfAlien
Posts: 20
Joined: Tue Jan 28, 2014 2:08 pm

Re: draw3DLine not working

Post by AlfAlien »

Thank you, very much!
I didn't know because read only documentation/comments inside source files.
horvatha4
Posts: 12
Joined: Sun Feb 23, 2014 6:03 am
Location: Rheiland-Pfalz, Germany
Contact:

Re: draw3DLine not working

Post by horvatha4 »

Hi!
This code draw only black lines. Equal where and what color I set. The transform is ok.

Code: Select all

 
    irr::video::SMaterial debugmaterial;
    debugmaterial.DiffuseColor = irr::video::SColor( 0xFFFFFF00 );
    debugmaterial.AmbientColor = irr::video::SColor( 0xFFFFFF00 );
    this->avideodriver->setMaterial( debugmaterial );
    this->avideodriver->setTransform(irr::video::ETS_WORLD, irr::core::IdentityMatrix);
    this->avideodriver->draw3DLine( 
        irr::core::vector3df(from.getX(), from.getY(), from.getZ() ), 
        irr::core::vector3df(to.getX(), to.getY(), to.getZ() )
        //,irr::video::SColor( 256, 128, 128, 0 )
        );
 
What made I wrong?
I use Windows7 64 bit and Visual Express 2010.
Thanks
Arpi
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: [SOLVED] draw3DLine not working

Post by CuteAlien »

Set debugmaterial.Lighting = false.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
horvatha4
Posts: 12
Joined: Sun Feb 23, 2014 6:03 am
Location: Rheiland-Pfalz, Germany
Contact:

Re: [SOLVED] draw3DLine not working

Post by horvatha4 »

Yess!
Thanks a lot!
Arpi

p.s I post this because my irr::scene::SMesh draw only black lines and triangles too. Set Light=false solve all the problem.
Everything is black till I add a Light (scene node)?
Post Reply