fullscreen drawing area and ofGetWidth() does not match


i noticed that if i set my app to fullscreen then if i ask for ofGetWidth() or ofGetHeigth() I dont get the rendering area size but the one hardcoded in file main.cpp. In my case even if my screen resolution is 1024x768 and I open my app fullscreen the command ofGetWidth() returns 800 which is the size typed in main.cpp
ofSetupOpenGL(&window, 800,600, OF_WINDOW);

I know i could use ofGetScreenWidth() and ofGetScreenHeight() but isnt this a kind of bug? I mean, should not OF internaly match the new drawing area since the description of ofGetWidth() says :

The width of the window expressed in pixels. Doesn’t include the borders of the window, just the drawing area.

or maybe i am missig something??



afaik, the designed behaviour for fullscreen is to resize the desktop display to the requested width and height. for example, if my monitor is 1920x1080 it’s important that i can resize in code to 800x600 to avoid nasty fill-rate issues.

are you sure your display isn’t switching to the requested resolution when you go fullscreen? if it’s not, it should. are you on Linux?

no it is not changing the screen resolution. i am on windows XP on a IBM X32 laptop with ATI mobillity radeon card. i just did the same test under linux (ubuntu karmic) and i get the same result. maybe i am missing something?

i am doing this on setup()

void testApp::setup()  
    printf( "%i, %i, %i, %i", ofGetWidth(), ofGetHeight() ofGetScreenWidth(), ofGetScreenHeight() );  

and made sure that main.cpp says

	ofSetupOpenGL(&window, 800,600, OF_WINDOW);  

and it prints “800, 600, 1024, 768”

i tested it with the empty example to make sure i wasnt doing something wrong somewhere else.

i need to be able to specify in an xml file, using XML addon, if the app should open fullscreen or not. Then later i am using ofGetWidth(), ofGetHeight() to resize some media to fill the whole screen. At the moment i am getting OF fullscreen (1024x768) but then the videos get opened with 800x600 size.



aah, i see.

i think you need to be calling

ofSetupOpenGL(&window, 800,600, OF_FULLSCREEN);   

from there you should be able to turn fullscreen off if necessary.

alternatively, i think you should be able read the res/fullscreen settings from your xml file in the main.cpp, using ofxXmlSettings, and pass them to the ofSetupOpenGL call.

changing that does not make any difference. I still get printed
“800, 600, 1024, 768” from the setup function
printf( “%i, %i, %i, %i”, ofGetWidth(), ofGetHeight() ofGetScreenWidth(), ofGetScreenHeight() );

as you pointed out the problem is that it is not actually changing the display resolution, it should match the size passed to the ofSetupOpenGL as far as I understand. I think this should be done by GLUT.

I think the thing is that on the “setup” frame, we don’t know the actual size of a fullscreen window. can you try printing the info in update and draw as well and see what they say?

take care,

you are right, printing from update shows the right values. good to know (maybe something to add in the docs?)