// OpenGL_Step1_Window.cpp : Defines the entry point for the console application.
//
// Following a building blocks approach, I have created a bare bones glut Window 
//
// Deborah R. Fowler
// Date: Nov 5, 2011
// Modified: Dec 21, 2012 for use on linux platform
// Modified: June 26, 2019 for use with Visual Studios 2017 and added instructions for adding gl
//
// USING GL - instructions at http://deborahrfowler.com/OpenGLResources/usingOpenGLwithVSandFreeGlut.html
//      1. Tools/NuGet Package Manager/Manage NuGet Packages for Solution
//      2. Click on Browse and search for nupengl.core
//      3. Select it, select checkbox for project and install
//
// See www.deborahrfowler.com for instructions on using Eclipse, Visual Studios, command line on Windows 
// and Eclipse, command line on linux
//
// Input: none
// Output: basic glut calls open a green background graphics window 
//
// #include "pch.h" // Needed if you are using Visual Studios 2017 

#include <GL/glut.h>            // This must have capital GL on Linux, but Windows allows either gl or GL

void initWindow();
void display();

int main(int argc, char *argv[])
{
        glutInit(&argc, argv);
        initWindow();
        glutDisplayFunc(display);
        glutMainLoop();

        return 0;
}

// display()
// 
// This is were the action is taking place for drawing
//

void display()
{
        // Clear
        glClear(GL_COLOR_BUFFER_BIT);

        // don't wait - start processing buffered OpenGL routines - without this you may not see what is current
        glFlush();

}


// Sets up a Window 
//
// The default is a window with center  0, 0, 0 and goes out to -1 and 1, 
// this is the default glOrtho(-1.0, 1.0, -1.0, 1.0, -1.0, 1.0 );
//
// By default it will open in the top left corner, small size 300 by 300
//
// To change these defaults you can use the functions, for example
// glutInitWindowSize( 500, 500 );
// glutInitWindowPosition( 100, 100 );
//

void initWindow()
{
        // This creates the window with a given title
        glutCreateWindow("Hello");

        // select clearing background color
        glClearColor(0.0, 1.0, 0.0, 0.0);
}

