Tuesday, 6 May 2014

Line



#include<windows.h>
#include<gl.h>
#include<glu.h>
#include<glut.h>
void Display(void);
void myInit(void);
int main(int argc,char **argv)
{
    glutInit(&argc,argv);
    glutInitDisplayMode(GLUT_SINGLE|GLUT_RGB);
    glutInitWindowSize(400,300);
   
       glutInitWindowPosition(0,0);
       glutCreateWindow("MY FIRST LINE");
                myInit();
         glutDisplayFunc(Display);
                glutMainLoop();
                return 0;
}
void myInit(void)
{
                glClearColor(1.0,1.0,1.0,0.0);
         glColor3f(1.0,0.0,0.0);
                glMatrixMode(GL_PROJECTION);
                glLoadIdentity();
                gluOrtho2D(0.0,800.0,0.0,600.0);
}

void Display(void)
{
     glClear(GL_COLOR_BUFFER_BIT);
                 glBegin(GL_LINES);
                 glVertex2f(0,0);
     glVertex2f(800,600);
                 glEnd();
                 glFlush();
}

No comments:

Post a Comment