Tuesday, September 05, 2006

Coding therapy

This is what I usually do whenever I am tired and hungry.



#include <GL/glut.h>

void disp(void)
{
glClear(GL_COLOR_BUFFER_BIT);
glColor3d(0.43, 0.12, 1.00);

glBegin(GL_POLYGON);
glVertex3f(-0.75, -0.75, 0.0);
glVertex3f( 0.75, -0.75, 0.0);
glVertex3f( 0.75, 0.75, 0.0);
glVertex3f(-0.75, 0.75, 0.0);
glEnd();
glFlush();
}

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

void main(int argc, char **argv)
{
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
glutInitWindowSize(300,300);
glutInitWindowPosition(0, 0);
glutCreateWindow(argv[0]);

init();

glutDisplayFunc(disp);
glutMainLoop();
}

No comments: