Social Icons

Thursday, 13 February 2014

DRAWING TRIANGLE USING LINE LOOP

#include<GL/glu.h>
#include<GL/glut.h>
#include<GL/gl.h>

void display()
{
glClearColor(1.0,1.0,1.0,0.0);
     glClear(GL_COLOR_BUFFER_BIT);
     glColor3f(1.0,0.0,0.0);
   
   
     glPointSize(15);
     glBegin(GL_LINE_LOOP);
                        glVertex2f(90,100);
                        glVertex2f(180,100);
                        glVertex2f(140,150);
                       // glVertex2f(200,150);
     glEnd();
     glFlush();
}

void init(void)
{

   
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluOrtho2D(0.0,640.0,0.0,480.0);
}

int main(int argc,char **argv)
{
    glutInit(&argc,argv);
    glutInitWindowSize(640,480);
    glutInitWindowPosition(100,150);
    glutInitDisplayMode(GLUT_RGB|GLUT_SINGLE);
    glutCreateWindow("Going for a SMILEY :-)");
    init();
glutDisplayFunc(display);
   
    glutMainLoop();
}

No comments:

Post a Comment

 

Sample Text

Sample text

 
Just Programming Cse DriveReputation Management