Finding Current Screen Resolution

Started by
3 comments, last by Daaark 18 years, 10 months ago
Hey Guys, Is there anyway to find the screen resolution before I set up my OpenGL Window. What I am trying to do is set up my opengl window with the screen resolution that the user already has on their computer. I think this would be handy to know if the person is trying to play my game on a LCD screen, the game window would automatically be set to the native resolution and reduce the tearing effect LCDs have. Thanks in advance. EDIT: I probably should have posted this somewhere else, it really doesn't have anything to do with OpenGL, let me knwo if you want it moved.
My Current Project Angels 22 (4E5)
Advertisement
Assuming you are programming for Windows, you can use GetSystemMetrics(SM_CXSCREEN) and GetSystemMetrics(SM_CYSCREEN) for the width and height, respectively.
ReactOS - an Open-source operating system compatible with Windows NT apps and drivers
Under which OS?

On windows there's probably a win32API way to do it. A little googling tells me that someone submitted a patch to SDL to do it on both x and win32, but I don't think it's part of the release yet. this may help if you use SDL already.
[size="1"]
Thanks guys I got is working.
My Current Project Angels 22 (4E5)
This is what I use

void gl_video::GetDesktopInformation(void){    m_DesktopWidth = GetSystemMetrics(SM_CXSCREEN);    m_DesktopHeight = GetSystemMetrics(SM_CYSCREEN);    HDC hDesk = GetDC(HWND_DESKTOP);    m_DesktopColorBits = GetDeviceCaps(hDesk,BITSPIXEL);    return;}

This topic is closed to new replies.

Advertisement