• Advertisement
Sign in to follow this  

Finding 'allowed' resolutions?

This topic is 1771 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

Hi everyone,

 

It seems like a simple question, but how do I find out which resolutions are permitted by the chosen device? For example, when I create my device, it will only permit me to pass certain values for screen width and height into my perspective matrix.It works if I specify 1024x768, but it will fail to initialise D3D if I specify 1023x768, for example. There doesn't seem to be a place in the D3DCAPS9 structure for info about permitted resolutions - where can I find out about them?

 

Thanks!

Share this post


Link to post
Share on other sites
Advertisement

I use exactly this function. It works fine and is simple enough, but but warned: it lies occasionally. Especially the refresh rates it reports are wrong for certain display devices - overhead projectors are notorious for this, older monitors as well, or analogue-cable-connected displays. 

 

So my suggestion for a reasonably well-behaving game is: use this function, filter out the resolutions your game can't handle, always use the default refresh rate whatever the monitor tells you, and you'll still need one of these obnoxious "Press OK to keep this resolution. Will switch back to previous setting in 15... 14..." dialogs to be safe.

Share this post


Link to post
Share on other sites

What about this method?

 

IDirect3D9::EnumAdapterModes

 

I'd run with this rather than using the Win32 API function for a number of reasons.

 

Firstly, it's going to give you a list of modes that are more likely to work with D3D.  The Win32 function may give you all manner of weird and wacky modes for which hardware acceleration is unavailable, you may have to filter out 8bpp modes, etc.

 

Secondly, the D3DFORMAT and refresh rate it gives you can be safely plugged into your D3DPRESENT_PARAMETERS without any doubts.  Using Win32, if you get - say - a 32bpp mode, can you be certain that it's D3DFMT_X8R8G8B8?  Or D3DFMT_A8R8G8B8?  Or even D3DFMT_A2R10G10B10?  What about 16bpp modes?  There are another 3 variations on those.

 

What it comes down to is: if D3D provides a call for enumerating modes, then there's a good chance that actually using that call will be the preferred option.

Share this post


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

  • Advertisement