/* 
   Project: coevolutionary GP moto driving
   Dana Vrajitoru
   main.cc
   
   Main function. Should initialize the motorcycle object and the
   OpenGL environment.  
*/

#include "gl_interface.h"
#include "moto_geometry.h"
#include "scenery.h"
#include "moto_animate.h"

#include <stdlib.h>
#include <iostream>
#include <GL/glut.h>

int pwindow, swindow;

//extern Moto_animate *moto;

int main(int argc, char **argv)
{
  glutInit(&argc, argv);
  glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH);
  glutInitWindowSize(500, 500);
  pwindow = glutCreateWindow("Motorcycle");

  light_init();
  scene_init();

  /* need both double buffering and z buffer */
  glutReshapeFunc(my_reshape);
  glutDisplayFunc(render);
  glutIdleFunc(move_objects);
  glutMouseFunc(mouse);
  glutKeyboardFunc(skey);
  glutSpecialFunc(key);

  //glClearColor(0.5294, 0.8078, 0.980, 0.2);
  
  glClearColor(0.680, 0.93, 0.93, 0.2);
  glColor3f(1.0, 0.0, 0.0);

  swindow = glutCreateSubWindow(pwindow, 10, 10, 100, 100);
  light_init();
  draw_small();

  glutReshapeFunc(my_reshape);
  glutDisplayFunc(render);
  //  glutIdleFunc(move_objects);
  //  glutMouseFunc(mouse);
  //  glutKeyboardFunc(skey);
  //  glutSpecialFunc(key);
			
  // we're required to register a display func for 
  // each window
  glutDisplayFunc(display);

  glClearColor(0.2, 0.2, 0.2, 0.2);
  glColor3f(1.0, 0.0, 0.0);
  overview();

  glutMainLoop();
  return 0;
}
