Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


Change Resolutions

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

I''m trying to make it so I can change the resolution after direct draw is initialized, and all the surfaces for my game are loaded. I do know how to use the function SetDisplayMode. I tried just calling that to change resolutions but my screen goes black. So what do I need to do, release all the surfaces (including the primary surface and backbuffer) and reload all of my images onto new surfaces? I don''t really know what even happens to all of my surfaces when I call SetDisplayMode. Thanks for the help. - Andrew

Share this post

Link to post
Share on other sites

Releasing before the change and recreating and reloading after the change is a good idea.

When you change screen mode, the new mode uses a different amount of memory, this usually causes the video card to evict all surfaces from video memory and start again. This is what happens when a surface becomes lost. And why surfaces become lost when you Alt-Tab, particularly to a more memory intensive desktop.

You could use Restore() or RestoreAllSurfaces() and then reload the graphics, but often it''s more robust and simpler to Release() the surfcaes and recreate. Your code no doubt has functions which it''s using to create and load data into surfaces - with a bit of careful thought when planning the code it''s simple to do.

If you''re retrofitting this into the code, a simple way to do it is to have a "surface structure", something like:

int width, height;
blah formatinfo;
char szFullPathNameForSourceGraphics[MAX_PATH];

Then hold a list of those and tack that onto the loading and release code - that way you should have a list of all surfaces currently loaded and the pathnames of where to reload their graphics from.

Simon O''Connor
Creative Asylum Ltd

Share this post

Link to post
Share on other sites
Hey thanks a lot, that''s just what I needed to know, I already have it so alt tab works properly so it shouldn''t be too bad to get this working, Thanks again.

- Andrew

Share this post

Link to post
Share on other sites

  • 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!