Autostart - waiting for screen resolution to be set

Hi - I’ve got an OF application that opens at login on Mac OS - running as an installation in a gallery.

Mac OS was taking it’s time to decide on the screen resolution and the application was starting and determining the screen size before that had completed - so I added a crude delay to fix that - see below:

int main( ){
    ofSetupOpenGL(1024,1280,OF_FULLSCREEN);			// 512,640
    // this kicks off the running of my app
    // can be OF_WINDOW or OF_FULLSCREEN
    // pass in width and height too:
    ofRunApp(new ofApp());

But that’s now causing troubles - I think it’s contributing to the Mac shutting down because it’s panicking that the processor is fully occupied.

Can anyone suggest a more sensible way to sleep the thread or to resize the application if the screen changes during execution?


ofSleepMillis() maybe?

Thanks! And apologies for not looking more closely at the documentation!

maybe not applicable to your specific situation.
i have used this addon to set specific resolutions and display layouts.
this app started on booting of the computer , once done it starts the actual project app.
this might also help you to only run your app once the display setup is done.

ofxWatchdog can be useful also if you have issues with your app crashing (it basically listens in a separate thread and relaunches the app, it very good – sometimes even too good – at making your app stay up)

Brilliant - thanks all - will be adding ofxWatchdog immediately!