#include #include #include #include #include #include //FILE TOPEN & DRAW THE FIGURE float x1,y1,x2,y2; int sw=500,sh=400; char *name; void lineTo() { glBegin(GL_LINES); glVertex2f((GLfloat)x1,(GLfloat)y1); glVertex2f((GLfloat)x2,(GLfloat)y2); glEnd(); glFlush(); } void myInit() { glClearColor(0.0f,1.0f,1.0f,1.0f); // background is white glColor3f(0.0f,0.0f,0.0f); // set color of stuff glLoadIdentity(); glMatrixMode(GL_PROJECTION); gluOrtho2D(0,1,0,1); // gluOrtho2D(0,(GLdouble)sw,0,(GLdouble)sh,-1,1); // glMatrixMode(GL_MODELVIEW); glViewport(0,0,sw,sh); } void display() { FILE *in; int i,j ,points,lines; char ch; //,name[20]; //cout<<"Enter file name\n"; //cin>>name; glClear(GL_COLOR_BUFFER_BIT); // clear screen // glMatrixMode(GL_MODELVIEW); // set up rotation if((in=fopen(name,"r"))==NULL) printf("\nERROR;-"); else { while((ch=(char)fgetc(in))!='*'); //to read till **** while((ch=(char)fgetc(in))!='\n'); //reading **** fscanf(in,"%f %f %f %f",&x1,&y1,&x2,&y2); //pts. not used fscanf(in,"%d",&lines); //total no. of lines for(i=0;i-->