Program to plot Triangle Fan

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

void trianglefan()
{
glClear(GL_COLOR_BUFFER_BIT);
glColor3f(1,0,0);
glBegin(GL_TRIANGLE_FAN);
glVertex2i(-60,0);
glVertex2i(-30,0);
glVertex2i(-30,30);
glColor3f(0,1,0);
glVertex2i(0,0);
glColor3f(0,0,1);
glVertex2i(30,30);
glEnd();
glFlush();
}

void init()
{
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluOrtho2D(-65,50,-50,50);
}

int main(int argc,char **argv)
{
glutInitDisplayMode(GLUT_RGB|GLUT_SINGLE);
glutInitWindowSize(500,500);
glutCreateWindow("Triangle Fan");
init();
glutDisplayFunc(trianglefan);
glutMainLoop();

}


Popular posts from this blog

Shutdown Pc

Ellipse using OpenGl

String Comparisons