c++ - Visual Studio SFML 教程图形显示不正确

标签 c++ visual-studio sfml

我不确定这是 Visual Studio(我使用的是 Visual Studio Community 2017)还是 SFML 的问题。我遵循了 https://www.sfml-dev.org/tutorials/2.4/start-vc.php 上的配置过程并使用了他们的教程代码。 SFML 确实已配置,但测试图形图像未根据教程正确显示,并且所有内容似乎都垂直拉伸(stretch)。

#include <SFML/Graphics.hpp>
int main()
{
    sf::RenderWindow window(sf::VideoMode(200, 200), "SFML works!");
    sf::CircleShape shape(100.f);
    shape.setFillColor(sf::Color::Green);

    while (window.isOpen())
    {
        sf::Event event;
        while (window.pollEvent(event))
        {
            if (event.type == sf::Event::Closed)
                window.close();
        }

        window.clear();
        window.draw(shape);
        window.display();
    }

    return 0;
}

Output

最佳答案

如果您使用的是带双 GPU 的笔记本电脑,那么您的 Intel GPU 驱动程序已经过时并且存在错误,它会错误地在窗口上设置 OpenGL“绘图区域”。或者,您可以强制您的应用程序在专用 GPU 上运行。

关于c++ - Visual Studio SFML 教程图形显示不正确,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49701620/

相关文章:

c++ - 在 sf::Vector 中重载 operator< 时出错

c# - VisualSVN - 从单独的 Repos 添加?

c++ - 我不断收到错误消息,这是我第一次使用类,这是我的代码 :

c++ - 删除是一个成员函数?私有(private)的析构函数不会被删除调用吗?

c++ - 以编程方式使用 Mac 地址解析 IP 地址

c++ - 在 C++ 中接收错误 "member function must be called or its address taken in function"

c++获取ip地址的代码

css - Visual Studio 2013 在调试中破坏 CSS

c# - Nuget Library - 将库的 DLL 复制到当前项目的输出目录

c++ - 从另一个函数控制 RenderWindow