Sign in to follow this  
alimarandi

Draw connected lines with different thickness

Recommended Posts

Hi Everybody, I use the following commands to draw a set of connected lines with different colors. glLineWidth(Thickness); glLineStipple(1, LinePattern); glVertexPointer(3, GL_FLOAT, 0, pVertex3D); glColorPointer(4, GL_FLOAT, 0, pColor4D); glDrawElements(GL_LINES, TotalIndex, GL_UNSIGNED_INT, pIndex); The information for the colors are kept in pColor4D. Right now all the lines have the same thickness. Is there any way to draw the lines with different thickness? Just like what I did with colors here? Thank you, Ali

Share this post


Link to post
Share on other sites
I don't know too much about line thickness, but I do know some about point size. They seem close enought that one might apply to another.

For point size, there is only one way to change the size in an array like that. You have to use a Vertex program in order to change it. I know you can in cg, I'm not sure about the other languages. But that is the only way to efficiently change size. If efficiency isn't a problem (not at all), then you'll have to do something like this:

for(all points){
glLineWidth(something);
glBegin(GL_LINES);
glVertex3fv(something);
glVertex3fv(something_else);
glEnd();
}

So if setting up a vertex program isn't too hard, then I'd give that a try. If you need help writing a simple cg program to change the size, I could try and help you out there.

remember I'm not 100% sure line width will work the same way as point size.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this