Skip to main content
gamedev.net
🔒 Locked

DrawPrimitive Line Width (?)

Started by amt35 6 replies 6k views
Original Post
amt35
amt35
Does anybody know how I can set the width of my lines? I am using DrawPrimitive to draw my lines and DX 9.0. I was looking through the forum and found the following solution: http://www.gamedev.net/community/forums/topic.asp?topic_id=126184 However, this solution only works for flat horizontal lines. I need to set the line width of any line. Thanks, Andrew
DrunkenHyena
DrunkenHyena
DrawPrimitive does not support line widths. Your choices are:
1) D3DXLine (as mentioned above)
2) Roll your own by drawing a thin quad scaled appropriately
Stay Casual,KenDrunken Hyena</FON
amt35
amt35
If I am working in 3D space am I bound to option #2 or can I still use ID3DXLine? It appears from the documentation ID3DXLine is for 2D only.

-Thanks again everyone!!!
Samurai Jack
Samurai Jack
A line is not a 3D object. You do not need lines, what you need are CYLINDERS.
That will help you out. If you would like to simulate laser rays, you will have to take some sprites / pixel shaded quads. There is no way to automaticaly draw a 3D Cylinder.

Even if D3DX Supports cylinders, it will Create a MESH with vertex & index buffer, so you can take a 3D model which is the same.

You can still "SCALE" a cylinder with matrix operations.
hplus0603
hplus0603
Quote:
Roll your own by drawing a thin quad scaled appropriately


That's funny, given that Direct3D doesn't even support quads :-)

Those are two of the most annoying problems when porting from OpenGL to D3D: no line width support, and no quads. But both a line, and a quad, really only are two triangles, so you can write adapter functions that do the right thing.
enum Bool { True, False, FileNotFound };
DrunkenHyena
DrunkenHyena
Quote:
Original post by hplus0603
Quote:
Roll your own by drawing a thin quad scaled appropriately


That's funny, given that Direct3D doesn't even support quads :-)

Those are two of the most annoying problems when porting from OpenGL to D3D: no line width support, and no quads. But both a line, and a quad, really only are two triangles, so you can write adapter functions that do the right thing.


Sure D3D does, you just draw 2 triangles. D3D programmers can handle "complex" concepts like that. ;)

If you use the Quad primitive in OGL, you're just forcing the driver to do additional work since it needs to break them down to triangles anyway.
Stay Casual,KenDrunken Hyena</FON
Tybon
Tybon
You can use the ID3DXLine::DrawTransform method to draw lines in 3D, but you need to provide it with (world*view*projection) transformation matrix.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.