• 16
• 15
• 12
• 9
• 10

Detecting a widescreen monitor

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

Recommended Posts

Using DirectX is there a way to detect whether a monitor is widescreen or not before device creation? I was thinking of making a method that gets the adapter's current display mode and calculating aspect ratio from that. But, many widescreen monitors support 4:3 resolutions and the above method would give me incorrect results if the widescreen monitor is using a 4:3 resolution. So, what I'm looking to do is use or make a method similar to the XNA GraphicsAdapter.IsWidescreen property. Any ideas?

Share on other sites
If I'm correct, the GraphicsAdapter.IsWideScreen just tells you whether or not the current display mode is widescreen.

I have to ask though, why does it matter? You shouldn't care whether or not it's a widescreen monitor; you should only care what resolution the user wants (or is using at the moment.)

My best recommendation would be to use your idea. Use GetDisplayMode() and you can tell from there whether or not they're using a widescreen resolution. AFAIK, there isn't a way to differentiate from fullscreen monitors from widescreen monitors.

Share on other sites
If you're about to create your device, you know your target resolution, which is either user specified in your game's video settings or simply the current display mode. Just check what aspect ratio that is. The actual monitor's physical dimensions are none of your business.

Share on other sites
What promit said, it's actually easy once you know the resolution (p-code):
int width;int height;...float normalRatio = 4.0 / 3.0;float widescreenRatio = 16.0 / 9.0;float currentRatio = float(width) / float(height);if (currentRatio near widescreenRatio) {    // is widescreen} else if (currentRatio near normalRatio) {    // is "normal"} else {    // is funky}

Share on other sites
Quote:
 Original post by Programmer16If I'm correct, the GraphicsAdapter.IsWideScreen just tells you whether or not the current display mode is widescreen.I have to ask though, why does it matter? You shouldn't care whether or not it's a widescreen monitor; you should only care what resolution the user wants (or is using at the moment.)

Because people want to know! Especially gamers!

I've played many games that include format information next to each resolution (4:3, 16:9, widescreen).

In fact, I would always add this. People want to know if they're selecting a widescreen format or not.
They don't want to do long division in their head to figure it out.

[Edited by - samster581 on January 7, 2009 3:22:43 AM]

Share on other sites
It's worthwhile finding out the physical aspect ratio if you want your game to look right when someone uses a resolution that has a different aspect ratio to the monitor. Everything will look stretched if you don't use the physical aspect ratio.

The API for finding the physical monitor size on Windows is GetDeviceCaps().

Share on other sites
The user can change the display resolution at any time(well, its good for a game to provide this functionality). It wont be 4:3 or 16:9 aspect...its ridiculous to let the user stuck at only these two values. Its much easier to, everytime the resolution changes, you compute the new aspect ratio and your new projection matrix.

Share on other sites
Quote:
 Original post by phresnelWhat promit said, it's actually easy once you know the resolution (p-code):*** Source Snippet Removed ***

you shouldn't forget about 5:4 and 8:5 (16:10) monitors, they're actually extremely common. (perhaps even more common than 4:3 and 16:9 these days on computer monitors)

Share on other sites
GetDeviceCaps is not accurate sometimes (I have found on laptops, it seems to take in to account from the top edge of the plastic on the screen down to the bottom of the laptop, which can serious throw off calculations, but I have no idea how this works under the hood, probably the laptop manufacturers fault somehow.)