how to draw lines?

to draw lines moving from left to right and vice versa, up to down and vice versa?
please help with the code?

You can do it the same way you draw any primitive in OpenGL :

glBegin(…) and glEnd().

For lines you can use

glBegin(GL_LINES);
glVertex2f(x1,y1);
glVertex2f(x2,y2);
glEnd();

x1,y1 are the start position and x2,y2 are the end, assuming you are only doing 2D drawing.

Find the redbook examples somewhere they have all of this stuff and more in it.

If you want to move the lines just define a delta for each coordinate that will be added each frame. For instance:

delta = 1.0;

void renderScene(){

x1 += delta;
x2 += delta;


Then just use the code form the previous reply.
}

In this case the line will move from the left ot the right. The variable delta controls the speed, the higher the value the faster the line moves.

Antonio www.fatech.com/tech