D3D line thickness not honoured

You discovered a bug in the engine, and you are sure that it is not a problem of your code? Just post it in here. Please read the bug posting guidelines first.
Post Reply
itzjac
Posts: 57
Joined: Fri Nov 17, 2006 7:41 pm
Location: Mexico City

D3D line thickness not honoured

Post by itzjac »

I'm using draw3DLine funciton with OpenGL driver without problems, I need to make big the thickness of the line (as well to the end/start points of that line) I wonder if there is some parameter I can set as in OpengL state

Code: Select all

 glPointSize(6.0f;)
I don't wan to use a model to get the same effect but in the end if it's very difficult I will do... :shock:
Acki
Posts: 3496
Joined: Tue Jun 29, 2004 12:04 am
Location: Nobody's Place (Venlo NL)
Contact:

Post by Acki »

you'll have to set the material and there you can define the thickness for the line... ;)

Code: Select all

// set the material
SMaterial theMat;
theMat.Thickness = 10;
driver->setMaterial(theMat);

// and maybe set the transformation
driver->setTransform(video::ETS_WORLD, core::matrix4());

// then draw the line(s)
but all this you also can find in the API at the description of draw3DLine (it's realy a magic file) !!! ;)
while(!asleep) sheep++;
IrrExtensions:Image
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
itzjac
Posts: 57
Joined: Fri Nov 17, 2006 7:41 pm
Location: Mexico City

Post by itzjac »

Thanks Acki I see I can set the material property I want in the draw3DLine section with setMaterial and it has lot of custom parameters... (solved) :D
starphoenix
Posts: 13
Joined: Thu Mar 27, 2008 2:59 am

Post by starphoenix »

reviving a dead topic, but I'm trying to use the material thickness and its not drawing the lines with the appropriate thickness, or color that i specified. im just trying to draw springs in my physics sim as lines between the two bodies they are attatched to, with interpolated colors depending on if its being stretched or compressed:

Code: Select all

			core::matrix4 mat1;
			driver->setTransform(video::ETS_WORLD, mat1);
			Spring *s = springs[i];
			Vector3D st = bodies[s->ID1]->GetPos();
			Vector3D en = bodies[s->ID2]->GetPos();
			core::vector3df start(st[X], st[Y], st[Z]); 
			core::vector3df end(en[X], en[Y], en[Z]);
			video::SColor col(255,255,255,255);
			//Going to interpolate color to indicate compression or tension
			if(s->GetStretch() < 0)
			{
				col = col.getInterpolated(video::SColor(255,255,64,64), (-s->GetStretch()/s->GetLength()));
			}
			else if(s->GetStretch() > 0)
			{
				col = col.getInterpolated(video::SColor(255,64,255,64), (s->GetStretch()/s->GetLength()));
			}
			video::SMaterial mat;
			mat.Thickness = 10;
			mat.DiffuseColor = col;
			driver->setMaterial(mat);
			driver->draw3DLine(start, end, col);
but after setting the material im just getting 1 pixel wide lines in all black.
starphoenix
Posts: 13
Joined: Thu Mar 27, 2008 2:59 am

Post by starphoenix »

I fixed the coloring issue, I had to set lighting to false, but I'm still not getting the adjusted thickness
itzjac
Posts: 57
Joined: Fri Nov 17, 2006 7:41 pm
Location: Mexico City

Post by itzjac »

Is your driver OpenGL?... I have read that OpenGL is the best option if you want to modify such parameters... but your code is ok as I can see...
With the general proccess and OpengL

Code: Select all

// set the material
SMaterial theMat;
theMat.Thickness = 10;
driver->setMaterial(theMat);

// and maybe set the transformation
driver->setTransform(video::ETS_WORLD, core::matrix4());

// then draw the line(s)
you must not have any problem..
starphoenix
Posts: 13
Joined: Thu Mar 27, 2008 2:59 am

Post by starphoenix »

I was using DX9, openGL does indeed work though, thanks
aheymann
Posts: 153
Joined: Wed Aug 22, 2007 12:25 pm
Location: England

Post by aheymann »

Does this mean thicknessing is not supported in DirectX?
JP
Posts: 4526
Joined: Tue Sep 13, 2005 2:56 pm
Location: UK
Contact:

Post by JP »

Yep.
Image Image Image
aheymann
Posts: 153
Joined: Wed Aug 22, 2007 12:25 pm
Location: England

Post by aheymann »

That is a major problem! Do you know if there are any plans to support it, or might the way to solve it, to use a shader (YIKES)!

Anton
JP
Posts: 4526
Joined: Tue Sep 13, 2005 2:56 pm
Location: UK
Contact:

Post by JP »

instead of drawing a 3D line you could just draw a cube stretched between the two desired points.
Image Image Image
MasterGod
Posts: 2061
Joined: Fri May 25, 2007 8:06 pm
Location: Israel
Contact:

Post by MasterGod »

Better be a sphere IMO where you scale only one axis to make it look like a line.
Image
Dev State: Abandoned (For now..)
Requirements Analysis Doc: ~87%
UML: ~0.5%
JP
Posts: 4526
Joined: Tue Sep 13, 2005 2:56 pm
Location: UK
Contact:

Post by JP »

Why a sphere? That wouldn't really end up looking like a line as the thickness of it would decrease from the centre to the ends... Plus it would be a lot more polys to render ;)
Image Image Image
bitplane
Admin
Posts: 3204
Joined: Mon Mar 28, 2005 3:45 am
Location: England
Contact:

Post by bitplane »

I guess CD3D?Driver::draw3DLine should draw a quad instead of a line if the material's thickness is anything other than 1.0f, I'll move this thread to bug reports and add to the tracker as a minor bug.

Done: http://sourceforge.net/tracker/index.ph ... tid=540676
Submit bugs/patches to the tracker!
Need help right now? Visit the chat room
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Well, it would be a billboard then, because you have to align it with the camera. Not that nice, but due to the limitation of D3D unavoidable.
Post Reply