PDA

View Full Version : drawing lines with angles



coda
01-01-2004, 04:31 PM
suppose i want to draw 2 lines that meets, with an angle of 57 deg between them, how do i code it in opengl? do i need to calculate the actual coordinates/vertexes?

mikael_aronsson
01-01-2004, 11:54 PM
Well, you do need to specify the vertices because OpenGL do not now where you want the lines, you have to say that at a minimum, something like:

glBegin( GL_LINES);
glVertex3d( 0, 0, 0);
glVertex3d( 0, 10, 0);
glEnd();

Then you could use:
glRotate( 57, 0, 0, 1);

And then draw same line again and you would get two lines that meet at 0,0,0 and have 57 degrees angle between them.

Mikael