//  main.cpp
//  OpenGL_HelloWorld
//  Created by pgAgent on 13/06/2015.
//  Copyright (c) 2015 RJM Programming. All rights reserved.
//
#include <stdlib.h>
#include </Applications/MAMP/htdocs/glew-1.12.0/include/GL/glew.h>
#ifdef __APPLE__
#  include <GLUT/glut.h>
#else
#  include <GL/glut.h>
#endif

void display (void) {
    glClearColor(1.0f, 0.0f, 0.0f, 1.0f);
    glClear(GL_COLOR_BUFFER_BIT);
    glLoadIdentity();
    
    glFlush();
}
static int make_resources(void) {
    return 1;
}
static void update_fade_factor(void) {
}
static void render(void) {
    glClearColor(0.5f, 0.5f, 0.5f, 0.5f);
    glClear(GL_COLOR_BUFFER_BIT);
    glutSwapBuffers();
}
int main (int argc, char **argv) {
    if (1 == 1) {  // thanks to http://duriansoftware.com/joe/An-intro-to-modern-OpenGL.-Chapter-2:-Hello-World:-The-Slideshow.html
        glutInit(&argc, argv);
        glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE);
        glutInitWindowSize(400, 300);
        glutCreateWindow("Hello World");
        glutDisplayFunc(&render);
        glutIdleFunc(&update_fade_factor);
        glutMainLoop();
    } else {
        glutInit(&argc, argv);
        glutInitDisplayMode (GLUT_SINGLE);
        glutInitWindowSize (500, 500);
        glutInitWindowPosition (100, 100);
        glutCreateWindow ("Your first OpenGL Window ... Hello World");
        glutDisplayFunc(display);
        glutMainLoop();
    }
}
