Page 1 of 1

[SOLVED] draw3DLine not working

Posted: Wed Mar 05, 2014 11:12 am
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?

Re: draw3DLine not working

Posted: Wed Mar 05, 2014 11:16 am
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).

Re: draw3DLine not working

Posted: Wed Mar 05, 2014 12:58 pm
by AlfAlien
Thank you, very much!
I didn't know because read only documentation/comments inside source files.

Re: draw3DLine not working

Posted: Tue Apr 01, 2014 4:20 pm
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

Re: [SOLVED] draw3DLine not working

Posted: Tue Apr 01, 2014 4:30 pm
by CuteAlien
Set debugmaterial.Lighting = false.

Re: [SOLVED] draw3DLine not working

Posted: Tue Apr 01, 2014 4:37 pm
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)?