From what I've read in the other posts in this forum, there's some significant trouble with this. My problem is that no matter what I do, the line is transparent.
Does anyone have any work arounds for drawing lines? I can't just use directx calls since this program needs to be platform independent.
draw3DLine() : Has anyone got this going?
I don't know where is the problem, 3d lines are working fine for me. I looked in source code, only what I don't understand is why Niko has implemented clipping for DirectX9? Clipping is allredy done by DirectX.
Anyway, this function is not enough for me, I have implemented function drawIndexed3DLineList which can render lines as much you want in one pass.
Anyway, this function is not enough for me, I have implemented function drawIndexed3DLineList which can render lines as much you want in one pass.
Got it.
Well, I figured it out. It was the order that things were done. By the look of it, there's like a global material that is used for drawing, and isn't saved and restored after each draw. This is what I had to do to get it drawing properly.
I'm sure a few of those calls to reset the matrix are redundant, but everything seems to need resetting to get normal lines drawn.
Code: Select all
//Run message loop.
while(device->run())
{
driver->beginScene(true, true, SColor(0,200,200,200));
driver->setTransform(video::ETS_WORLD, core::matrix4());
smgr->drawAll();
driver->setTransform(video::ETS_WORLD, core::matrix4());
guienv->drawAll();
driver->setTransform(video::ETS_WORLD, core::matrix4());
video::SMaterial m;
m.MaterialType = EMT_SOLID;
m.AmbientColor = SColor(0,255,255,255);
m.Lighting = false;
driver->setMaterial(m);
driver->draw3DLine(core::vector3df(0.0, 0.0, 0.0),
core::vector3df(10.0, 0.0, 0.0), SColor(0, 255, 0, 0)) ;
driver->draw3DLine(core::vector3df(0.0, 0.0, 0.0),
core::vector3df(00.0, 10.0, 0.0), SColor(0, 0, 255, 0)) ;
driver->draw3DLine(core::vector3df(0.0, 0.0, 0.0),
core::vector3df(00.0, 0.0, 10.0), SColor(0, 0, 0, 255)) ;
driver->endScene();
Sleep(.01);
}