#include "ofMain.h"
#include "ofApp.h"
#if (OF_VERSION_MINOR != 9) && defined(TARGET_OPENGLES)
#include "ofGLProgrammableRenderer.h"
#endif

//#define FORCE_PROGRAMMMABLE 1
//#define FORCE_APPGLFW 1
//#define FORCE_APPGLFW_PROGRAMMMABLE 1
//#define FORCE_NOAPP 1
#define FORCE_APPGLUT 1

#ifdef FORCE_PROGRAMMMABLE
#include "ofGLProgrammableRenderer.h"
#endif

#ifdef FORCE_APPGLFW_PROGRAMMMABLE
//#include "ofAppGLFWWindow.h"
#include "ofGLProgrammableRenderer.h"
#endif

#ifdef FORCE_APPGLFW
#include "ofAppGLFWWindow.h"
#endif

#ifdef FORCE_NOAPP
#include "ofAppNoWindow.h"
#endif

#ifdef FORCE_APPGLUT
#include "ofAppGlutWindow.h"
#endif

int main()
{
    ofSetLogLevel(OF_LOG_VERBOSE);
#if defined(TARGET_OPENGLES)
    #if (OF_VERSION_MINOR == 9)
        ofGLESWindowSettings settings;
        settings.setSize(1280, 720);
        settings.setGLESVersion(2);
        ofCreateWindow(settings);
	ofRunApp( new ofApp());
    #else
        ofSetLogLevel("ofThread", OF_LOG_ERROR);
        ofSetCurrentRenderer(ofGLProgrammableRenderer::TYPE);
        ofSetupOpenGL(1280, 720, OF_WINDOW);
	ofRunApp( new ofApp());
    #endif
#elif FORCE_PROGRAMMMABLE
    ofGLWindowSettings glWindowSettings;
    glWindowSettings.setSize(1280, 720);

    glWindowSettings.setGLVersion(3, 2);

    ofCreateWindow(glWindowSettings);
    ofRunApp( new ofApp());
#elif FORCE_APPGLFW
    ofGLFWWindowSettings settings;
//#if FORCE_APPGLFW_PROGRAMMMABLE
//    settings.setGLVersion(3, 2);  // Programmable pipeline >> you need to define GL_VERSION_3 in you pre-processor macros!
//#endif
    settings.setSize(1280, 720);
    //settings.setPosition(ofVec2f(300,0));
    //settings.resizable = true;
    //shared_ptr<ofAppBaseWindow> mainWindow = ofCreateWindow(settings);
    //mainWindow->setVerticalSync(false);
    ofCreateWindow(settings);
    ofRunApp( new ofApp());
#elif FORCE_APPGLUT
    ofAppGlutWindow window;
    ofSetupOpenGL(&window,1280,720,OF_WINDOW);
    ofRunApp( new ofApp());
#elif FORCE_NOAPP
    auto window = make_shared<ofAppNoWindow>();
    auto app = make_shared<ofApp>();
    ofRunApp(window, app);
    ofRunMainLoop();

    //ofGLFWWindowSettings settings;
    //settings.visible = false;
    //ofCreateWindow(settings);
    // this kicks off the running of my app
    // can be OF_WINDOW or OF_FULLSCREEN
    // pass in width and height too:
    //ofAppNoWindow window;
    //ofSetupOpenGL(&window, 1024, 768, OF_WINDOW);
#else
    ofSetLogLevel("ofThread", OF_LOG_ERROR);
    ofSetupOpenGL(1280, 720, OF_WINDOW);
    ofRunApp( new ofApp());
#endif
}