Automatic display config in OF_GAME_MODE

Hi there,

I want my app to get the screen’s width and height and to launch a glut window in game mode with the same resolution. This would be very convenient since the display would configure itself automatically on every computer screen.

I found a hackish way to do it in ofAppGlutWindow.cpp in the setupOpenGL function (this fragment is called after glutInit):

  
int swidth = glutGet(GLUT_SCREEN_WIDTH);  
int sheight = glutGet(GLUT_SCREEN_HEIGHT);  
  
char gameStr[64];  
sprintf( gameStr, "%dx%d:%d@%d", swidth, sheight, 32, 60 );  
glutGameModeString(gameStr);  

Is there any better way to do this?
Do you see any potential disadvantages with this method?
Would an upscale be preferable for huge screens?

Thanks a lot.

in main.cpp just start with any resolution in OF_GAME_MODE, then in testApp::setup() put this line:

  
ofSetWindowShape(ofGetScreenWidth(),ofGetScreenHeight());  

works for me on linux, not sure about other platforms.

Thanks for the reply (and sorry for not mentioning I was on Mac OS X).
Although ofSetWindowShape works in fullscreen mode, it doesn’t in game mode.
Since it works with my method, I’ll probably keep it and add a maximum for big screens (like 1920x1080) as well as a minimal display configuration menu in the app to be sure it’s bullet proof. I’ll post some code if I discover tricks along the way that are worth sharing.

cheers