summaryrefslogtreecommitdiff
path: root/gui/src/main.cpp
blob: 3e4c327029e2218ff3d23dabcadb95c824384a28 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#include "ofMain.h"
#include "ofApp.h"



//========================================================================
int main(int argc, char *argv[]){
	/*
	ofSetupOpenGL(1600,200,OF_WINDOW);			// <-------- setup the GL context

	// this kicks off the running of my app
	// can be OF_WINDOW or OF_FULLSCREEN
	// pass in width and height too:
	ofApp *app = new ofApp();
    
    
    
	ofRunApp(app); // start the app
	*/

	//app->arguments = vector<string>(argv, argv + argc);

	ofGLFWWindowSettings settings;

#ifdef GPU_ALGORITHM
	settings.setGLVersion(3,2); //doesn't support gluLookat
#endif //GPU_ALGORITHM

	settings.width = 1024;
	settings.height = 576;
	settings.setPosition(ofVec2f(1700,0));
	settings.resizable = true;
	//settings.decorated = false; //doesn't suppress FS title bar
	shared_ptr<ofAppBaseWindow> mainWindow = ofCreateWindow(settings);

	// share OpenGL resources with other windows
	settings.shareContextWith = mainWindow;	
	settings.decorated = true;

	settings.width = 800;
	settings.height = 450;
	settings.setPosition(ofVec2f(1400,0));
	settings.resizable = true;
	shared_ptr<ofAppBaseWindow> previewWindow = ofCreateWindow(settings);
	previewWindow->setVerticalSync(false);

	settings.width = 1600;
	settings.height = 400;
	settings.setPosition(ofVec2f(0,700));
	settings.resizable = true;
	
	shared_ptr<ofAppBaseWindow> guiWindow = ofCreateWindow(settings);
	guiWindow->setVerticalSync(false);

	shared_ptr<ofApp> mainApp(new ofApp);
	//mainApp->setupGui();

	ofAddListener(mainWindow->events().update,mainApp.get(),&ofApp::updateOutput);
	ofAddListener(mainWindow->events().draw,mainApp.get(),&ofApp::drawOutput);
	ofAddListener(mainWindow->events().windowResized,mainApp.get(),&ofApp::outputWindowResized);
	ofAddListener(mainWindow->events().keyPressed,mainApp.get(),&ofApp::outputKeyPressed);

	ofAddListener(previewWindow->events().draw,mainApp.get(),&ofApp::drawOutput);
	
	ofRunApp(guiWindow, mainApp);
	ofRunMainLoop();
}