//======================================================================== int main( ) { ofGLFWWindowSettings settings; settings.width = 700; settings.height = 800; settings.setPosition(ofVec2f(0,0)); settings.resizable = false; shared_ptr<ofAppBaseWindow> guiWindow = ofCreateWindow(settings); settings.width = 1280; // 1920 settings.height = 720; // 1080 settings.resizable = true; settings.setPosition( ofVec2f(1440, 0 )); // settings.windowMode = OF_FULLSCREEN; shared_ptr<ofAppBaseWindow> mainWindow = ofCreateWindow(settings); shared_ptr<GuiApp> guiApp(new GuiApp); shared_ptr<ofApp> mainApp(new ofApp); mainApp->gui = guiApp; ofRunApp(mainWindow, mainApp); ofRunApp(guiWindow, guiApp); ofRunMainLoop(); }
//======================================================================== int main( ){ ofGLFWWindowSettings settings; settings.width = 600; settings.height = 600; settings.setPosition(ofVec2f(300,0)); settings.resizable = true; settings.numSamples = 8; shared_ptr<ofAppBaseWindow> mainWindow = ofCreateWindow(settings); settings.width = 300; settings.height = 300; settings.setPosition(ofVec2f(0,0)); settings.resizable = false; settings.numSamples = 4; settings.shareContextWith = mainWindow; shared_ptr<ofAppBaseWindow> guiWindow = ofCreateWindow(settings); shared_ptr<ofApp> mainApp(new ofApp); shared_ptr<GuiApp> guiApp(new GuiApp); mainApp->gui = guiApp; mainApp->window = mainWindow; mainApp->gl = dynamic_pointer_cast<ofBaseGLRenderer>(mainWindow->renderer()); ofRunApp(guiWindow, guiApp); ofRunApp(mainWindow, mainApp); ofRunMainLoop(); }
int main( ){ ofGLFWWindowSettings winSettings; winSettings.numSamples = 8; winSettings.width = 1920 + 1920 + 1200; winSettings.height = 1200; winSettings.decorated = false; winSettings.multiMonitorFullScreen = true; //winSettings.monitor = 1; #ifdef TARGET_WIN32 winSettings.width = 1200 * 10; winSettings.height = 1920; #endif // winSettings.width = 1200 * 6; // winSettings.height = 1920 * 2; shared_ptr<ofAppBaseWindow> win = ofCreateWindow(winSettings); // sets up the opengl context! #ifdef TARGET_OSX ((ofAppGLFWWindow*)win.get())->setWindowPosition(-1920, 0); #endif ofRunApp(win, shared_ptr<ofBaseApp>(new testApp())); ofRunMainLoop(); }
int main() { ofSetLogLevel(OF_LOG_VERBOSE); ofJson config = ofLoadJson("../../../SharedData/settings.json"); shared_ptr<ofAppNoWindow> winServer(new ofAppNoWindow); shared_ptr<ServerApp> appServer(new ServerApp); ofRunApp(winServer, appServer); ofGLFWWindowSettings settings; settings.setGLVersion(3,2); settings.decorated = false; settings.numSamples = 1; settings.resizable = true; int n = config["projectors"].size(); for(int i = 0; i < n; i++) { ofJson curConfig = config["projectors"][i]; settings.monitor = curConfig["monitor"]; settings.setSize(curConfig["width"], curConfig["height"]); settings.setPosition(ofVec2f(curConfig["xwindow"], curConfig["ywindow"])); settings.multiMonitorFullScreen = curConfig["multimonitor"]; settings.windowMode = curConfig["fullscreen"] ? OF_FULLSCREEN : OF_WINDOW; shared_ptr<ofAppBaseWindow> winClient = ofCreateWindow(settings); shared_ptr<ClientApp> appClient(new ClientApp); appClient->config(i, appServer); ofRunApp(winClient, appClient); } ofRunMainLoop(); }
//======================================================================== int main( ){ ofGLFWWindowSettings settings; settings.width = 600; settings.height = 600; settings.setPosition(ofVec2f(300,0)); settings.resizable = true; shared_ptr<ofAppBaseWindow> mainWindow = ofCreateWindow(settings); settings.width = 300; settings.height = 300; settings.setPosition(ofVec2f(0,0)); settings.resizable = false; // uncomment next line to share main's OpenGL resources with gui //settings.shareContextWith = mainWindow; shared_ptr<ofAppBaseWindow> guiWindow = ofCreateWindow(settings); guiWindow->setVerticalSync(false); shared_ptr<ofApp> mainApp(new ofApp); mainApp->setupGui(); ofAddListener(guiWindow->events().draw,mainApp.get(),&ofApp::drawGui); ofRunApp(mainWindow, mainApp); ofRunMainLoop(); }
//======================================================================== int main( ){ // ofSetupOpenGL(500,250,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: // ofRunApp(new ofApp()); ofGLFWWindowSettings settings; settings.width = 500; settings.height = 250; settings.setPosition(ofVec2f(300,0)); settings.resizable = true; shared_ptr<ofAppBaseWindow> mainWindow = ofCreateWindow(settings); settings.width = 300; settings.height = 300; settings.setPosition(ofVec2f(0,0)); settings.resizable = false; // uncomment next line to share main's OpenGL resources with gui //settings.shareContextWith = mainWindow; shared_ptr<ofAppBaseWindow> guiWindow = ofCreateWindow(settings); guiWindow->setVerticalSync(false); shared_ptr<ofApp> mainApp(new ofApp); mainApp->setupMonitor(); ofAddListener(guiWindow->events().draw,mainApp.get(),&ofApp::drawMonitor); ofRunApp(mainWindow, mainApp); ofRunMainLoop(); }
//======================================================================== int main(int argc, char *argv[]){ SystemConfiguration system; system.setup(); // this kicks off the running of my app // can be OF_WINDOW or OF_FULLSCREEN // pass in width and height too: ofRunMainLoop(); }
//-------------------------------------- int ofRunApp(shared_ptr<ofBaseApp> app){ mainLoop()->run(app); auto ret = ofRunMainLoop(); app.reset(); #if !defined(TARGET_ANDROID) && !defined(TARGET_OF_IOS) ofExitCallback(); #endif return ret; }
int main() { ofGLFWWindowSettings settings; auto window = ofCreateWindow(settings); auto app = make_shared<ofApp>(); ofRunApp(window, app); return ofRunMainLoop(); }
//======================================================================== int main( ) { ofInit(); auto window = make_shared<ofAppNoWindow>(); auto app = make_shared<ofApp>(); // this kicks off the running of my app // can be OF_WINDOW or OF_FULLSCREEN // pass in width and height too: ofRunApp(window, app); return ofRunMainLoop(); }
int main() { ofGLFWWindowSettings settings; settings.width = 1920; settings.height = 1080; auto window = ofCreateWindow(settings); auto app = make_shared<ofApp>(); ofRunApp(window, app); return ofRunMainLoop(); }
//======================================================================== int main( ){ ofGLFWWindowSettings windowSettings; windowSettings.setGLVersion( 4, 4 ); windowSettings.width = 270; windowSettings.height = 270; windowSettings.windowMode = OF_WINDOW; auto window = ofCreateWindow( windowSettings ); std::shared_ptr<ofApp> colorMapApp( new ofApp() ); ofRunApp( window, colorMapApp ); ofRunMainLoop(); }
//======================================================================== int main( ){ #ifdef TARGET_OPENGLES ofGLESWindowSettings settings; settings.glesVersion = 2; auto window = ofCreateWindow(settings); auto app = make_shared<ofApp>(); ofRunApp(window, app); return ofRunMainLoop(); #else ofSetupOpenGL(1024,768,OF_WINDOW); ofRunApp(new ofApp()); #endif }
//======================================================================== int main( ){ //ofSetCurrentRenderer(ofGLProgrammableRenderer::TYPE); ofGLFWWindowSettings winSettings; winSettings.numSamples = 8; shared_ptr<ofAppBaseWindow> win = ofCreateWindow(winSettings); // sets up the opengl context! ((ofAppGLFWWindow*)win.get())->setMultiDisplayFullscreen(true); ofRunApp(win, shared_ptr<ofBaseApp>(new ofApp())); ofRunMainLoop(); }
int main(int argc, const char** argv){ ofxArgParser::init(argc, argv); #ifdef TARGET_OPENGLES ofGLESWindowSettings settings; settings.windowMode = OF_FULLSCREEN; settings.glesVersion = 2; #else ofGLWindowSettings settings; settings.setGLVersion(3,2); #endif auto window = ofCreateWindow(settings); auto app = make_shared<gorgone>(); ofRunApp(window, app); return ofRunMainLoop(); }
int main() { int numScreens = 1; int screenWidth = 1920; int screenHeight = 1200; ofGLFWWindowSettings settings; settings.multiMonitorFullScreen = true; settings.resizable = false; settings.setSize(screenWidth * numScreens, screenHeight); settings.windowMode = OF_FULLSCREEN; auto window = ofCreateWindow(settings); auto app = std::make_shared<ofApp>(); ofRunApp(window, app); return ofRunMainLoop(); }
//======================================================================== int main( ){ //ofSetCurrentRenderer(ofGLProgrammableRenderer::TYPE); ofGLFWWindowSettings winSettings; winSettings.numSamples = 8; winSettings.width = 640; winSettings.height = 480; shared_ptr<ofAppBaseWindow> win = ofCreateWindow(winSettings); // sets up the opengl context! ((ofAppGLFWWindow*)win.get())->setMultiDisplayFullscreen(false); // 10 x 1 screens //ofSetupOpenGL(&win, w, h, OF_WINDOW /*OF_FULLSCREEN*/); // <-------- setup the GL context ofRunApp(win, shared_ptr<ofBaseApp>(new ofApp())); ofRunMainLoop(); }
//======================================================================== int main( ){ // ofGLWindowSettings settings; // settings.setGLVersion(3,2); // ofCreateWindow(settings); //classic // ofSetupOpenGL(1024, 576, OF_WINDOW); // ofRunApp(new ofApp()); //multi ofGLFWWindowSettings settings; //mainWindow settings.width = 1024; settings.height = 512; settings.setPosition(ofVec2f(300,0)); settings.resizable = true; shared_ptr<ofAppBaseWindow> mainWindow = ofCreateWindow(settings); //timelineWindow settings.width = 576; settings.height = 750; settings.setPosition(ofVec2f(0,0)); settings.resizable = false; shared_ptr<ofAppBaseWindow> timelineWindow = ofCreateWindow(settings); shared_ptr<ofApp> mainApp(new ofApp); shared_ptr<TimelineApp> timelineApp(new TimelineApp); mainApp->timelineApp = timelineApp; ofRunApp(timelineWindow, timelineApp); ofRunApp(mainWindow, mainApp); ofRunMainLoop(); }
//======================================================================== int main( ){ ofGLFWWindowSettings settings; settings.setSize(600, 600); settings.setPosition(ofVec2f(300,0)); settings.resizable = true; shared_ptr<ofAppBaseWindow> mainWindow = ofCreateWindow(settings); settings.setSize(300, 300); settings.setPosition(ofVec2f(0,0)); settings.resizable = false; shared_ptr<ofAppBaseWindow> guiWindow = ofCreateWindow(settings); shared_ptr<ofApp> mainApp(new ofApp); shared_ptr<GuiApp> guiApp(new GuiApp); mainApp->gui = guiApp; ofRunApp(guiWindow, guiApp); ofRunApp(mainWindow, mainApp); ofRunMainLoop(); }
//======================================================================== int main( ) { // ofSetupOpenGL(1024,768,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: // ofRunApp(new ofApp()); ofGLFWWindowSettings settings; settings.width = 1280; settings.height = 768; settings.setPosition(ofVec2f(0,0)); settings.resizable = true; settings.title = "Main"; shared_ptr<ofAppBaseWindow> mainWindow = ofCreateWindow(settings); settings.width = 800; settings.height = 600; settings.setPosition(ofVec2f(-800,0)); settings.title = "Proj"; settings.resizable = false; settings.decorated = false; settings.shareContextWith = mainWindow; // uncomment next line to share main's OpenGL resources with gui //settings.shareContextWith = mainWindow; shared_ptr<ofAppBaseWindow> projWindow = ofCreateWindow(settings); projWindow->setVerticalSync(false); shared_ptr<ofApp> mainApp(new ofApp); // mainApp->setupGui(); ofAddListener(projWindow->events().draw,mainApp.get(),&ofApp::drawProj); mainApp->projWindow = projWindow; ofRunApp(mainWindow, mainApp); ofRunMainLoop(); }
//======================================================================== int main( ){ ofSetLogLevel(OF_LOG_VERBOSE); #ifdef TARGET_OPENGLES ofLogVerbose("enigmatikViewer") << "Running in rpi mode using OPENGL " << glGetString(GL_VERSION) << endl; // useful for later? http://ofxfenster.undef.ch/doc/structofAppEGLWindow_1_1Settings.html //ofSetCurrentRenderer(ofPtr<ofBaseRenderer>(new ofGLProgrammableRenderer())); //ofSetCurrentRenderer(ofGLProgrammableRenderer::TYPE); //ofAppEGLWindow::Settings settings; //settings.eglWindowOpacity = 127; //settings.frameBufferAttributes[EGL_DEPTH_SIZE] = 0; // 0 bits for depth //settings.frameBufferAttributes[EGL_STENCIL_SIZE] = 0; // 0 bits for stencil //ofAppEGLWindow window(settings); //ofSetupOpenGL( 800,600, OF_WINDOW); // car rearview screen resolution: 320*240 ofGLESWindowSettings windowSettings; windowSettings.width =320; windowSettings.height = 240; windowSettings.setGLESVersion(2); shared_ptr<ofAppBaseWindow> window = ofCreateWindow(windowSettings); // configure renderer //shared_ptr<ofBaseRenderer> renderer = new ofGLProgrammableRenderer(window.get()); //renderer->setBackgroundAuto(false); //renderer->enableAntiAliasing(); //ofSetCurrentRenderer(renderer); #else //ofSetCurrentRenderer(ofGLProgrammableRenderer::TYPE); //ofAppGLFWWindow window; //ofSetupOpenGL(&window, 800,600, OF_WINDOW);// <-------- setup the GL context //ofPtr<ofBaseRenderer> renderer( new ofGLProgrammableRenderer(OF_WINDOW) ); //renderer->setBackgroundAuto(false); //renderer->disableAntiAliasing(); //ofSetCurrentRenderer(ofGLProgrammableRenderer::TYPE); #ifdef USE_PROGRAMMABLE_GL // we are using the programmable gl renderer. ofGLESWindowSettings windowSettings; //ofGLWindowSettings windowSettings; //ofGLFWWindowSettings windowSettings; windowSettings.width = 800; windowSettings.height = 600; windowSettings.setGLESVersion(2); //windowSettings.setGLVersion(3, 2); shared_ptr<ofAppBaseWindow> window = ofCreateWindow(windowSettings); // configure renderer ofGLProgrammableRenderer * renderer = new ofGLProgrammableRenderer( window.get() ); renderer->setBackgroundAuto(false); renderer->enableAntiAliasing(); ofSetCurrentRenderer(shared_ptr<ofBaseRenderer>((ofBaseRenderer*) renderer)); ofLogVerbose("enigmatikViewer") << "Running in desktop mode using PROGRAMMABLE_GL " << glGetString(GL_VERSION) << endl; #else //ofGLESWindowSettings windowSettings; ofGLWindowSettings windowSettings; //ofGLFWWindowSettings windowSettings; windowSettings.width = 800; windowSettings.height = 600; windowSettings.setGLVersion(4, 1); shared_ptr<ofAppBaseWindow> window = ofCreateWindow(windowSettings); //ofDisableArbTex(); #endif #endif ofSetVerticalSync(false); ofEnableAlphaBlending(); // otherwise alpha channel is ignored by GL ofSetBackgroundColor(0,255,255,.5f);//ofColor(255,255,255,255)); ofSetBackgroundAuto(false); // tmp shared_ptr<enigmatikViewer> mainApp(new enigmatikViewer ); ofRunApp(window, mainApp); ofRunMainLoop(); }
void AppSystem::main() { setup(); ofRunApp(_simulationWindow, _simulationApp); ofRunMainLoop(); }
int main() { int numWindows = 3; shared_ptr<ofApp> mainApp(new ofApp); vector< shared_ptr<ofAppBaseWindow> > windows; /*for(int i=0;i<numWindows;i++){ ofGLFWWindowSettings settings; settings.width = 600; settings.height = 600; settings.setPosition(ofVec2f(1920*i+100,0)); settings.resizable = true; if(i > 0){ settings.shareContextWith = ofGetMainLoop()->getCurrentWindow(); } shared_ptr<ofAppBaseWindow> win = ofCreateWindow(settings); win->setVerticalSync(false); win->setFullscreen(true); windows.push_back(win); //win.setMultiDisplayFullscreen(true); //this makes the fullscreen window span across all your monitors ofRunApp(windows[i], mainApp); }*/ ofGLFWWindowSettings settings; settings.width = 600; settings.height = 600; settings.setPosition(ofVec2f(1600,0)); settings.resizable = false; settings.decorated = false; settings.monitor = 1; shared_ptr<ofAppBaseWindow> win = ofCreateWindow(settings); win->setVerticalSync(false); win->setWindowTitle("Projector 1"); windows.push_back(win); settings.width = 600; settings.height = 600; settings.setPosition(ofVec2f(1920,0)); settings.resizable = false; settings.shareContextWith = ofGetMainLoop()->getCurrentWindow(); shared_ptr<ofAppBaseWindow> win2 = ofCreateWindow(settings); win2->setWindowTitle("Projector 2+3"); win2->setVerticalSync(false); windows.push_back(win2); /* win->setWindowPosition(1920, 0); win->setWindowShape(1920, 1200); win2->setWindowPosition(1920, 0); */ mainApp->windows = windows; ofRunApp(windows[0], mainApp); ofRunApp(windows[1], mainApp); ofRunMainLoop(); }
//-------------------------------------- int ofRunApp(shared_ptr<ofBaseApp> app){ mainLoop()->run(app); return ofRunMainLoop(); }
//======================================================================== int main( ){ ofGLFWWindowSettings mainSettings; mainSettings.resizable = false; mainSettings.setGLVersion(4, 1); mainSettings.decorated = false; ofGLFWWindowSettings guiSettings; guiSettings.resizable = true; guiSettings.setGLVersion(4, 1); // Get screen widths and heights from Quartz Services // See https://developer.apple.com/library/mac/documentation/GraphicsImaging/Reference/Quartz_Services_Ref/index.html CGDisplayCount displayCount; CGDirectDisplayID displays[32]; // Grab the active displays CGGetActiveDisplayList(32, displays, &displayCount); int numDisplays= displayCount; // print display info. cout<<numDisplays<<" display(s) detected."<<endl; for (int i = 0; i < displayCount; i++){ cout << displays[i] << "\t(" << CGDisplayPixelsWide(displays[i]) << "x" << CGDisplayPixelsHigh(displays[i]) << ")"<< endl; } CGRect mainDisplayBounds= CGDisplayBounds ( displays[0] ); if(numDisplays == 1 ){ float divisions = 4.0; // one display: palce gui and mainWindow in a default arrangement mainSettings.width = round(mainDisplayBounds.size.width * (divisions-1) / divisions); mainSettings.height = round((mainSettings.width * (9.0 / 16.0)) / 2.0); mainSettings.setPosition(ofVec2f(round(mainDisplayBounds.size.width / divisions) ,mainDisplayBounds.origin.y)); mainSettings.decorated = true; guiSettings.width = round(mainDisplayBounds.size.width - 100); guiSettings.height = mainDisplayBounds.size.height - 100; guiSettings.setPosition(ofVec2f(mainDisplayBounds.origin.x, mainDisplayBounds.origin.y + 80)); cout << "configured default one display setup" << endl; } else if (numDisplays > 1){ // two displays: palce resizeable gui on first and fill second with undecorated mainWindow - will also work with dual head configuraions for projectors guiSettings.width = mainDisplayBounds.size.width; guiSettings.height = mainDisplayBounds.size.height - 100; guiSettings.setPosition(ofVec2f(mainDisplayBounds.origin.x, mainDisplayBounds.origin.y)); CGRect secondDisplayBounds= CGDisplayBounds ( displays[1] ); mainSettings.width = secondDisplayBounds.size.width; mainSettings.height = secondDisplayBounds.size.height; mainSettings.setPosition(ofVec2f(secondDisplayBounds.origin.x,secondDisplayBounds.origin.y)); // CGError e = CGDisplaySetStereoOperation(displays[1], true, true, kCGConfigureForAppOnly); // if(e == kCGErrorRangeCheck) cout << "no hardware stereo" << endl; // if(e == kCGErrorSuccess) cout << "hardware stereo" << endl; if (numDisplays > 2 ) { // three or more displays: palce resizeable gui on first and fill second and third with undecorated mainWindow, if they are same size. CGRect thirdDisplayBounds= CGDisplayBounds ( displays[2] ); if(secondDisplayBounds.size.width == thirdDisplayBounds.size.width && secondDisplayBounds.size.height == thirdDisplayBounds.size.height){ mainSettings.width = secondDisplayBounds.size.width * 2; mainSettings.setPosition(ofVec2f(1,1)); cout << "configured default three display setup" << endl; } } else { cout << "configured default two display setup" << endl; } } shared_ptr<ofAppBaseWindow> mainWindow = ofCreateWindow(mainSettings); guiSettings.shareContextWith = mainWindow; shared_ptr<ofAppBaseWindow> guiWindow = ofCreateWindow(guiSettings); //guiWindow->setVerticalSync(false); shared_ptr<ofApp> mainApp(new ofApp); mainApp->setupGui(guiWindow, mainWindow); ofAddListener(guiWindow->events().draw,mainApp.get(),&ofApp::drawGui); // gui events to main app gui listener functions #define guiEventMacro(NAME) ofAddListener(guiWindow->events() . NAME , mainApp.get(), &ofApp::NAME ## Gui); guiEventMacro(keyPressed); guiEventMacro(keyReleased); guiEventMacro(mouseMoved); guiEventMacro(mouseDragged); guiEventMacro(mousePressed); guiEventMacro(mouseReleased); guiEventMacro(mouseEntered); guiEventMacro(mouseExited); guiEventMacro(windowResized); ofRunApp(mainWindow, mainApp); ofRunMainLoop(); }