// BasicShader.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include <GL/glut.h>
#include <iostream>
#include <string.h>
#include <fstream>
#include <sstream>

// using namespace std;


bool LoadTXTFile(const char *fileName, std::string &textFile)
	{
		std::stringstream strStream;

		std::ifstream file(fileName, std::ifstream::in);
		if(!file.good())
			return false;

		strStream << file.rdbuf();
		textFile = strStream.str();
		file.close();

		return true;
	}

void InitGlut(int argc, char** argv)
{
	glutInit(&argc, argv);
	glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
	glutInitWindowSize(500, 500);
	glutInitWindowPosition(100, 100);
	glutCreateWindow(argv[0]);
}

void GLInit()
{
	glClearColor(0.0, 0.0, 0.0, 0.0);
}



void display(void)
{
	glClear(GL_COLOR_BUFFER_BIT);
	glColor3f(1.0, 1.0, 1.0);
	glLoadIdentity();
	gluLookAt(0.0, 0.0, 5.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0);

	glutWireCube(1.0);
	glBegin(GL_TRIANGLES);
	  glVertex3f(1.0, 1.0, 0.0);
	  glVertex3f(0.0, 1.0, 0.0);
	  glVertex3f(1.0, 0.0, 0.0);
	glEnd();

	glFlush();
}

void reshape(int w, int h)
{
	glViewport(0, 0, (GLsizei) w, (GLsizei) h);
	glMatrixMode(GL_PROJECTION);
	glLoadIdentity();
	        //(Left, Right, Bottom, Top, Near, Far);
	glFrustum(-1.0, 1.0, -1.0, 1.0, 1.5, 20.0);
	glMatrixMode(GL_MODELVIEW);
}

void keyboard(unsigned char key, int x, int y)
{if ((int)key == 27) exit(0);}

void GlutCallbacks()
{
	glutDisplayFunc(display);
	glutReshapeFunc(reshape);
	glutKeyboardFunc(keyboard);
}

void CheckVersions()
{
}

void CreateFirstShader()
{
}

int _tmain(int argc, char** argv)
{
	InitGlut(argc, argv);
	GLInit();

	CheckVersions();

	GlutCallbacks();

	CreateFirstShader();

	glutMainLoop();
	return 0;
}

