Archived

This topic is now archived and is closed to further replies.

LeLe

3D line with color pattern?

Recommended Posts

How can I render a 3D line with the color pattern applying on it?And the width of line can be specialized.

Share this post


Link to post
Share on other sites
I''m only familiar with OpenGL, so here is what I know

What you want is called Line Stippling in OpenGL. Unfortunately you can only stipple patters of Color,No color, but you can draw lines on top of lines to get multiple patterns. The function is glLineStipple(int factor, GLushort patter) where factor is some number i don''t understand when its other than 1 and pattern is 16 bits that define Color,No color. The line width can be set to a number of pixels with glLineWidth(int width). Again these are only for OpenGL, but DirectX probably has something similar.

RELIGION IS THE ROOT OF ALL EVIL

Share this post


Link to post
Share on other sites
If you want to change line thickness, render the lines as textured quads. If you want to specify the lines in screen space, use an ortho projection matrix D3DXMatrixOrthoLH.

Share this post


Link to post
Share on other sites
What you can do is using a gradient, say for example one end of the line yellow, the other one blue and the line itself will blend smoothly those 2 colors. To do this you must give the two vertices a diffuse color.

Share this post


Link to post
Share on other sites