//------------------------------------------------------------------------------
//  Copyright 2007-2014 by Jyh-Ming Lien and George Mason University
//  See the file "LICENSE" for more information
//------------------------------------------------------------------------------


#include "main.h"

//
//
//
//
//   The MAIN function
//
//
//
//

int main(int argc, char ** argv)
{
    //
    if(!parseArg(argc,argv)){
        printUsage(argv[0]);
        return 1;
    }

    //read models
	initialize(rt_filename);
    //


    /////////////////////////////////////////////////////////////////
	//
    // setup glut/gli
	//
	/////////////////////////////////////////////////////////////////
    glutInit( &argc, argv );
    glutInitDisplayMode( GLUT_RGB|GLUT_DOUBLE|GLUT_DEPTH );
	glutInitWindowSize(image_w, image_h);
    glutInitWindowPosition( 50, 50 );
	string title = "RT openGL Viewer: ";
	title += rt_filename;
	glutCreateWindow(title.c_str());

    InitGL();
    gli::gliInit();
    gli::gliDisplayFunc(Display);
    glutReshapeFunc(Reshape);
    glutKeyboardFunc(Keyboard);

    //set camera position
	gli::setCameraPosX(camera.pos[0]);
	gli::setCameraPosY(camera.pos[1]);
	gli::setCameraPosZ(camera.pos[2]);
	Reshape(image_w, image_h);

    /////////////////////////////////////////////////////////////
    gli::gliMainLoop();

    return 0;
}

