bool CGDI_X::ChangeDisplayMode(int pixel_width, int pixel_height, bool switch_back)
{
// If we're switching back to "our normal resolution"
if(switch_back)
{
// By passing in NULL we're saying "Go back to screen resolution logged in the registry"
// 0 says "do this dynamically (like now)"
// **Note this should not fail, that's why we don't check (could if you wanted to)
ChangeDisplaySettings(NULL,0);
return true;
}
DEVMODE dev_mode = {0};
LONG result;
// This call is going to get us the current display Settings -- By parameter:
// NULL -- This specifies which display device (NULL means current display device)
// ENUM_CURRENT_SetTINGS -- Retrieve the current Settings for the display device
// dev_mode -- Address of DEVMODE structure to fill with the display Settings
if(!EnumDisplaySettings(NULL,ENUM_CURRENT_SETTINGS,&dev_mode))
return false;
// We have a DEVMODE filled with all the current Settings
// so lets change the ones we want to
dev_mode.dmPelsWidth = pixel_width;
dev_mode.dmPelsHeight = pixel_height;
// Now we'll try to change to the new Settings
// CDS_FULLSCREEN -- flag says this change is "temporary" (there are other flags you can pass in)
result = ChangeDisplaySettings(&dev_mode,CDS_FULLSCREEN);
// ChangeDisplaySettings() returns DISP_CHANGE_SUCCESSFUL when it's successful
if(result == DISP_CHANGE_SUCCESSFUL)
return true;
else
return false; // No changing to full screen :(
}
Why does full screen cut my FPS 80ish%
I'm using GDI as my rendering API right now, and I programmed a very simple tilemap engine that gets about 120 fps in 800x600. When I go to full screen my fps drops to about 27 fps! My full screen code looks like so->
Does anyone have any clue to as what is going on? If I switch to OpenGL or DirectX, will my FPS go up or down depending on being in FullScreen or not? Thank you for any help.
GDI isn't hardware accelerated, so the bigger the graphic region, the more performance is decreased.
Switching to OpenGL or Direct3D would definitely improve performance in full screen mode.
~Graham
Switching to OpenGL or Direct3D would definitely improve performance in full screen mode.
~Graham
Ok Thanks, I'm using the same width and height as I do in non full screen mode, 800x600. I'm just really surprised I lose so many frames by going into full screen mode even though the Width and Height are the same!
Quote:Original post by gwihlidal
GDI isn't hardware accelerated
Wow, why bother then lol. Software renderers rule! Might teach you the basics but as time goes on the basics are going to be eatten up by the video cards. I know a guy that is developing stuff for Windows 95 users still. *claps* like I want to deal with them for technical support!
Minor correction: Most video cards have acceleration for GDI, but not GDI+.
GDI+ is the one with all the pretty API powahs.
GDI+ is the one with all the pretty API powahs.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement