Jump to content
  • Advertisement
Sign in to follow this  
Sir Sapo

OpenGL Finding Current Screen Resolution

This topic is 4820 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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.

Share this post


Link to post
Share on other sites
Advertisement
Assuming you are programming for Windows, you can use GetSystemMetrics(SM_CXSCREEN) and GetSystemMetrics(SM_CYSCREEN) for the width and height, respectively.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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;
}

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!