Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Requested video mode is not available when using fullscreen style  (Read 3289 times)

0 Members and 1 Guest are viewing this topic.

Vehyr

  • Newbie
  • *
  • Posts: 1
    • View Profile
    • Email
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

Hapax

  • Hero Member
  • *****
  • Posts: 3379
  • My number of posts is shown in hexadecimal.
    • View Profile
    • Links
Re: Requested video mode is not available when using fullscreen style
« Reply #1 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;
}
Selba Ward -SFML drawables
Cheese Map -Drawable Layered Tile Map
Kairos -Timing Library
Grambol
 *Hapaxia Links*