Switching video modes in Direct X

Started by
3 comments, last by Leprosy 23 years, 7 months ago
What needs to be done in order to switch video modes in directx? ie going from 640 x 480 to 800 x 600. any breif insight or articles would be greatly appreciated. Is there an open source free DX wrapper library that has support for dx7. just functions like init, etc? thanks lep
Advertisement
eh, just create the direct draw object, and change the video mode.. ie in dx7
    // GLOBALSLPDIRECTDRAW7  lpDD=NULL;unsigned long  width=640,height=480,bpp=8;// ddraw initDirectDrawCreateEx(NULL,(void**)&lpDD,IID_IDirectDraw7,NULL);lpDD->SetDisplayMode(width,height,bpp,0,0);    


then you go and set cooperative level and create your surfaces and what not and you''re set.
if you mean your app needs to switch resolutions dynamically just destroy all your direct draw stuff and recreate everything at the new resolution.
You could check out: Creating a Fullscreen Windows Application
Full source-code included. It''s also about changing resolution without DX.

quote:Original post by Leprosy

What needs to be done in order to switch video modes in directx?

You can set video mode and create surfaces once... as long as bit depth of new resolutions equal that of another display mode you want to set, you shouldn''t have to recreate all surfaces, just primary and back buffer(s).

quote:
Is there an open source free DX wrapper library that has support for dx7. just functions like init, etc?
thanks lep


Off the top of my head, cdx. There''s like a billion I''m sure.

___________________________Freeware development:ruinedsoft.com
I am writing my own DirectX wrapper library in Delphi and recently got the video mode switching along with full-screen/windowed switching working. What I do is fairly generic in that it just releases all surfaces and recreates them as necessary for the new resolution and bit-depth. I may add some smarts to it later on so it can choose which surfaces to keep and which to recreate during the switch, but for now it works in all cases. The library is smart enough at the moment to be able to automatically reload surfaces from bitmaps if required.



Steve 'Sly' Williams
Tools Developer
Krome Studios
Steve 'Sly' Williams  Monkey Wrangler  Krome Studios
turbo game development with Borland compilers

This topic is closed to new replies.

Advertisement