Program to plot Triangle
#include<GL/glut.h>
#include<GL/glu.h>
#include<GL/gl.h>
void triangle()
{
glClear(GL_COLOR_BUFFER_BIT);
glColor3f(1,0,0);
glBegin(GL_TRIANGLES);
glVertex2i(-60,-30);
glVertex2i(60,-30);
glVertex2i(0,60);
glEnd();
glFlush();
}
void init()
{
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluOrtho2D(-100,100,-100,100);
}
int main(int argc,char **argv)
{
glutInit(&argc,argv);
glutInitDisplayMode(GLUT_RGB|GLUT_SINGLE);
glutInitWindowSize(500,500);
glutCreateWindow("Triangle");
init();
glutDisplayFunc(triangle);
glutMainLoop();
}
#include<GL/glu.h>
#include<GL/gl.h>
void triangle()
{
glClear(GL_COLOR_BUFFER_BIT);
glColor3f(1,0,0);
glBegin(GL_TRIANGLES);
glVertex2i(-60,-30);
glVertex2i(60,-30);
glVertex2i(0,60);
glEnd();
glFlush();
}
void init()
{
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluOrtho2D(-100,100,-100,100);
}
int main(int argc,char **argv)
{
glutInit(&argc,argv);
glutInitDisplayMode(GLUT_RGB|GLUT_SINGLE);
glutInitWindowSize(500,500);
glutCreateWindow("Triangle");
init();
glutDisplayFunc(triangle);
glutMainLoop();
}