Program to plot a Line
#include<GL/glut.h>
#include<GL/glu.h>
#include<GL/gl.h>
void line()
{
glClear(GL_COLOR_BUFFER_BIT);
glColor3f(1.0,0,0);
//glLineWidth(10); //to change width of line. "1" is normal
glBegin(GL_LINES);
glVertex2f(-0.9,-0.8);
glVertex2f(0.8,0.9);
glEnd();
glFlush();
}
int main(int argc, char **argv)
{
glutInit(&argc,argv);
glutInitDisplayMode(GLUT_RGB|GLUT_SINGLE);
glutInitWindowSize(500,500);
glutCreateWindow("Line");
glutDisplayFunc(line);
glutMainLoop();
}
#include<GL/glu.h>
#include<GL/gl.h>
void line()
{
glClear(GL_COLOR_BUFFER_BIT);
glColor3f(1.0,0,0);
//glLineWidth(10); //to change width of line. "1" is normal
glBegin(GL_LINES);
glVertex2f(-0.9,-0.8);
glVertex2f(0.8,0.9);
glEnd();
glFlush();
}
int main(int argc, char **argv)
{
glutInit(&argc,argv);
glutInitDisplayMode(GLUT_RGB|GLUT_SINGLE);
glutInitWindowSize(500,500);
glutCreateWindow("Line");
glutDisplayFunc(line);
glutMainLoop();
}