API for finding screen size

Hi all,

is there any function in opengl, which can determine the screen size when an application is called.
as becoz setting parameters based on different screen sizes is quite a cumbersome task.

do let me know…

thanks in advance

Windows:
width = GetSystemMetrics(SM_CXSCREEN);
height= GetSystemMetrics(SM_CYSCREEN);

or, just for your primary monitor…

RECT r;
GetClientRect( GetDesktopWindow() ,&r );

so can these functions be put in the opengl code…will it work fine…

There is no reason why they should not work with an application that uses OpenGL. If you know one, please tell.

When i m using the Rect r;… at that instant its not of any help for my glutInitWindowSize() method as it accepts 2 parameters i.e XSIZE and the YSIZE.

Using the other declaration as
int width = GetSystemMetrics(SM_CXSCREEN);
int height= GetSystemMetrics(SM_CYSCREEN); in the main()

its working fine, but my application window is starting minimized at the beginning, and i m maximizing it using the mouse…which is not intended as how itz to work…

Plz let me know on this…

Using the RECT method: use r.right and r.bottom. Gotta check if you have to add 1 or not (dunno if it specifies the bottom-rightmost pixel or the size, I always use the other method). Anyways, it should be obvious if you try it and very easy to fix if it is wrong (just add or remove the “+ 1”).

And about it starting minimized, no idea. Check if by any chance the program is set to start minimized (right click on the EXE and select “Properties”). If you’re running it from an IDE, check if it isn’t the IDE’s fault (run the EXE directly instead from the IDE and see what happens).