Page 1 of 1

may be draw3DLine bug?

Posted: Thu Oct 06, 2005 11:51 pm
by populous
vector of line is affected by position of scene node

i want to draw from (0, 0, 0) to (0, 0, 100), but line is not there

i posted this problem in beginners help

Posted: Fri Oct 07, 2005 12:41 am
by BlackNinjaGames
Wouldn't that be a line going directly into the screen?

All you would see is a dot...

But im not sure :?

i modified engine source and solve the problem

Posted: Fri Oct 07, 2005 4:01 pm
by populous
i modified CD3D9Driver.cpp

Code: Select all

//! Draws a 3d line.
void CD3D9Driver::draw3DLine(const core::vector3df& start,
	const core::vector3df& end, SColor color)
{
	core::matrix4 mat;
	mat.makeIdentity();
	setTransform(ETS_WORLD, mat);

	setVertexShader(EVT_STANDARD);
	setRenderStates3DMode();
	video::S3DVertex v[2];
	v[0].Color = color;
	v[1].Color = color;
	v[0].Pos = start;
	v[1].Pos = end;

	pID3DDevice->DrawPrimitiveUP(D3DPT_LINELIST, 1, v, sizeof(S3DVertex));
}
reference above code

Posted: Mon Oct 31, 2005 10:15 pm
by gershon
you posted a bug,
now you cant draw the line in diffrent space.

i use
driver->setTransform(video::ETS_WORLD, core::matrix4());
to reset to the world matrix

but also
driver->setTransform(video::ETS_WORLD, node->getAbsoluteTransformation() );
driver->draw3DLine( vector3df(0,0,0), vector3df(0,0,10), RED );

now being in my node's own coordinate system i see a line pointing forward

Posted: Mon Oct 31, 2005 10:18 pm
by omaremad_
btw draw the line every frame after the scene has been rendered or it will be overwritten by the new frame's pixels

i had trouble with driverdraw image till i realised this

Posted: Tue Nov 01, 2005 7:57 am
by niko
This is not a bug, it is intended to work like this. It's even written down in the documentation. But I'm going to clarify it a bit there.