SFML community forums

Help => Window => Topic started by: Vehyr on June 08, 2020, 10:18:24 pm

Title: Requested video mode is not available when using fullscreen style
Post by: Vehyr on June 08, 2020, 10:18:24 pm
I get "the requested video mode is not available, switching to valid mode" when using fullscreen style but not with default style , any tips ?
window = new sf::RenderWindow(sf::VideoMode(rezolutionTemp.x,rezolutionTemp.y),"Title",sf::Style::Fullscreen);
vs
window = new sf::RenderWindow(sf::VideoMode(rezolutionTemp.x, rezolutionTemp.y), "Title", sf::Style::Default);
 

I'm using sfml 2.5.1 32 on win 10 64 in visual studio
Title: Re: Requested video mode is not available when using fullscreen style
Post by: Hapax on June 09, 2020, 12:37:41 am
When switching to fullscreen mode, the video mode must be one that the display can cope with.

To get a valid video mode for a display, you can check the collection of valid video modes for that display using
https://www.sfml-dev.org/documentation/2.5.1/classsf_1_1VideoMode.php#a6815b9b3b35767d5b4563fbed4bfc67b
e.g. to list all available video modes (for fullscreen), you can do something like this:
for (const auto& videoMode : sf::VideoMode::getFullscreenModes())
{
    std::cout << "resolution: " << videoMode.width << "x" << videoMode.height;
    std::cout << ", bits per pixel: " << videoMode.bitsPerPixel << std::endl;
}