Finding 'allowed' resolutions?

Started by
3 comments, last by 21st Century Moose 11 years, 1 month ago

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!

Advertisement

http://msdn.microsoft.com/en-us/library/dd162611%28v=vs.85%29.aspx

AFAIK that's the method you have to use.

Check out https://www.facebook.com/LiquidGames for some great games made by me on the Playstation Mobile market.

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.

----------
Gonna try that "Indie" stuff I keep hearing about. Let's start with Splatter.

What about this method?

IDirect3D9::EnumAdapterModes

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.

Direct3D has need of instancing, but we do not. We have plenty of glVertexAttrib calls.

This topic is closed to new replies.

Advertisement