Finding Current Screen Resolution
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.
Assuming you are programming for Windows, you can use GetSystemMetrics(SM_CXSCREEN) and GetSystemMetrics(SM_CYSCREEN) for the width and height, respectively.
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.
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.
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
Popular Topics
Advertisement