How to draw a line in OpenGl?

I want to draw a string in opengl.

glBegin(GL_LINES); glVertex2f(.25,0.25); glVertex2f(.75,.75); glEnd(); 

this line of code drawing, but if I want to draw a line from the coordinate (10,10) to coordinate (20,20), what will I do?

What does it mean (.25, .25) and (.75, .75)?

+4
source share
1 answer

(.25, .25) and (.75, .75) are the start and end points of the line.

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

 glBegin(GL_LINES); glVertex2f(10, 10); glVertex2f(20, 20); glEnd(); 
+17
source

All Articles