Drawing 3D line

Dear all,

I have a problem in drawing a 3D line which animates the change in the rotation of the line at different times.

Consider i have a vector of the line defined bye L=(x,y,z) i want to draw this line, in 3D such that the value of x,y and z vary every time and the line should also orient accordingly. x,y, and z are the components of the vector L and their values vary every time.

How can i show the 3D view of this line the actual orientation in OpenGl?

Please help.

thanks
thx

There are infinite lines matching your L vector. If I understand what you want, you should choose a first point (whatever you want), and calculate another point, using the first point and your L vector.

thank for your reply.

Ofcouse i will have the origin of my line. But assume i get the second point from the first point and the vector L, but how can i show the 3D view of my line? So the problem reduces to drawing a 3D line using two 3D points. When i try with Opengl utility glBegin(GL_Lines)
the two pts here
glEnd

I can only view a 2D line not 3D line.

By definition, a line is 2 dimensional.

If you want to see your line in different point of view, rotating around, translating and so on, you can use glTranslate, glRotate before drawing your line, or use gluLookAt which will allow you to specifiy where the camera is and where the camera looks at.

Dear friend

Imagine my line as a vector which changes its orientation every time and provide me your suggestions. Or you tell me how can i draw a perpendicular line to the screen. I prefer if u put some code samples.

thx

opendj, re-read and understand what arts said. Everything is explained.