#if defined(__APPLE__) && defined (__MACH__)
#   include <GLUT/glut.h>
#else
#   include <GL/glut.h>
#endif
#include <stdlib.h>
#include <stdio.h>
#include <math.h>

void display()
{
  glClear(GL_COLOR_BUFFER_BIT);
  glMatrixMode(GL_MODELVIEW);
  glLoadIdentity();
  gluLookAt(1.0, 0.5, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0);
  glutWireCube(2.0);
  glutSwapBuffers();
}

void reshape(GLsizei w, GLsizei h)
{
  glMatrixMode(GL_PROJECTION);
  glLoadIdentity();
  glOrtho(-4.0, 4.0, -4.0, 4.0, -4.0, 4.0);
  glViewport(0, 0, w, h);
}

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

void keyboard(unsigned char key, int x, int y)
{
  if(key == 'q' || key == 'Q' || key == 27)
    exit(0);
}

int main(int argc, char** argv)
{
  glutInit(&argc, argv);
  glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB);
  glutCreateWindow("Test 1");
  glutDisplayFunc(display);
  glutReshapeFunc(reshape);
  glutKeyboardFunc(keyboard);
  init();
  glutMainLoop();
  return 0;
}

