How to draw line in OpenGL?

(.25, .25) and (.75,.75) are line’s start and end point.

To draw a line from (10,10) to (20,20):

glBegin(GL_LINES);
    glVertex2f(10, 10);
    glVertex2f(20, 20);
glEnd();

Leave a Comment