
#include <GL/glut.h>

void display()
{
	glClear(GL_COLOR_BUFFER_BIT);
	
	glColor3f(1,1,1);

	glBegin(GL_TRIANGLES);
	glVertex3f(0,0,0);
	glVertex3f(1,0,0);
	glVertex3f(1,1,0);
	glEnd();
		
	glutSwapBuffers();
}

void reshape(int w, int h)
{
	glViewport(0,0, (GLsizei) w, (GLsizei) h);
	glMatrixMode(GL_PROJECTION);
	glLoadIdentity();
	
	gluPerspective(60.0, (GLfloat)w/(GLfloat)h, 1.0, 100.0 );
	glTranslatef(0,0,-10);
	glMatrixMode(GL_MODELVIEW);
	glLoadIdentity();
}

void init()
{
	glClearColor(0.0,0.0,0.0,0.0);
}

int main()
{	

	glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB |GLUT_DEPTH);
	glutInitWindowSize(500,500);
	glutInitWindowPosition(100,100);
	glutCreateWindow("Sample Glut window");
			
	init();

	glutReshapeFunc(reshape);
	glutDisplayFunc(display);	
	glutIdleFunc(display);
	glutMainLoop();	

	return 0;
}

