#include <GL/glut.h>
void display(){
glClearColor (0.0, 0.0, 0.0, 0.0);
glClear (GL_COLOR_BUFFER_BIT);
glLineWidth(2);//设置线段宽度
glBegin(GL_LINES);
glColor3f(1.0,0.0,0.0);
glEnd();
glFlush();
}
int main(int argc, char *argv[])
{
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
glutCreateWindow("A_Line");
glutDisplayFunc(display);
glutMainLoop();
}
void display(){
glClearColor (0.0, 0.0, 0.0, 0.0);
glClear (GL_COLOR_BUFFER_BIT);
glLineWidth(2);//设置线段宽度
glBegin(GL_LINES);
glColor3f(1.0,0.0,0.0);
glVertex2f(0.8,1); //定点坐标范围
glVertex2f(0,-1);glEnd();
glFlush();
}
int main(int argc, char *argv[])
{
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
glutCreateWindow("A_Line");
glutDisplayFunc(display);
glutMainLoop();
}