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 123 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: 3017
  • My number of posts is shown in hexadecimal.
    • View Profile
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
Kairos - Timing Library
Rectangular Boundary Collision - Rectangular SAT Collision

@Hapaxiation - Hapaxia on Twitter