Hi everyone, not sure if this is the right place to ask, but I'm having a problem with fullscreen mode on the new 14inch macbook pro. If I copy and run the code from the SFML videomode documentation ( https://www.sfml-dev.org/documentation/2.5.1/classsf_1_1VideoMode.php#a6815b9b3b35767d5b4563fbed4bfc67b ) it returns a vector of size 0.
If I try to manually force fullscreen video mode with
mWindow(sf::VideoMode(), "name", sf::Style::Fullscreen)
it crashes with error:
The requested video mode is not available, switching to a valid mode
Process finished with exit code 139 (interrupted by signal 11: SIGSEGV)
I've also tried with a specific VideoMode resolution. Is it possible that no fullscreen videomode is available? Does anyone know how to solve this problem?
That seems rather odd. Do you get any Desktop Modes at least?
I get:
3024x1964 - 32 bpp
by running sf::VideoMode::getDesktopMode() (which is the correct resolution of my screen).
I'm running a minimal example:
#include <vector>
#include <iostream>
#include <SFML/Window.hpp>
int main()
{
// Display the list of all the video modes available for fullscreen
std::vector<sf::VideoMode> modes = sf::VideoMode::getFullscreenModes();
for (std::size_t i = 0; i < modes.size(); ++i)
{
sf::VideoMode mode = modes[i];
std::cout << "Mode #" << i << ": "
<< mode.width << "x" << mode.height << " - "
<< mode.bitsPerPixel << " bpp" << std::endl;
}
sf::VideoMode defaultMode = sf::VideoMode::getDesktopMode();
std::cout << defaultMode.width << "x" << defaultMode.height << " - "
<< defaultMode.bitsPerPixel << " bpp" << std::endl;
sf::Window window(sf::VideoMode(800, 600), "My window");
// run the program as long as the window is open
while (window.isOpen())
{
// check all the window's events that were triggered since the last iteration of the loop
sf::Event event;
while (window.pollEvent(event))
{
// "close requested" event: we close the window
if (event.type == sf::Event::Closed)
window.close();
}
}
return 0;
}
I'm able to run any window by creating a specific VideoMode, the only thing that doesn't work is fullscreen.