/*
 * GLUT Shapes Demo
 *
 * Written by Nigel Stewart November 2003
 *
 * This program is test harness for the sphere, cone
 * and torus shapes in GLUT.
 *
 * Spinning wireframe and smooth shaded shapes are
 * displayed until the ESC or q key is pressed.  The
 * number of geometry stacks and slices can be adjusted
 * using the + and - keys.
 */

#ifdef __APPLE__
#include <GLUT/glut.h>
#else
#include <GL/glut.h>
#endif



#include<windows.h>
#include<stdlib.h>
#include<stdio.h>
int
xi =1,
yi = 1,
xii =90,
yii = 90;
void result(void){
    glClearColor(0.80,0.80,0.80,0.80);
    glColor3f(0.0f,0.0f,0.0f);
    glPointSize(3.0);
    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();
    gluOrtho2D(0.0,640.0,0.0,480.0);
}
void xy(int x, int y){
    glBegin(GL_POINTS);
    glVertex2i(x,y);
    glEnd();
    glFlush();
}

void mylin(int xi,int yi,int xii,int yii){
    int xdll = xii-xi;
    int rdll = yii-yi;
    int mm = (yii-yi)/(xii-xi);
    int xx,yy,x,y,m,i;
    if(mm>1){ m = xdll;}
    else{ m = rdll;}
    xx = xdll/ m;
    yy = rdll/m;

    for(i=1;i<m;i++){
        x=x+xx;
        y=y+yy;
        xy(x,y);
    }
}

void Display(void){
    glClear(GL_COLOR_BUFFER_BIT);
        mylin(xi,yi,xii,yii);
}

int main(int argc,char *argv[]){
    glutInit(&argc,argv);
    glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
    glutInitWindowSize(600,600);
    glutInitWindowPosition(50,50);
    glutCreateWindow("Shakil Hossain");
    glutDisplayFunc(Display);
    result();
    glutMainLoop();
    return EXIT_SUCCESS;
}
Leave a reply