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

Author Topic: Drawing Methods Reference Out Of Place with Distortion ?  (Read 2626 times)

0 Members and 1 Guest are viewing this topic.

leowribeiro

  • Newbie
  • *
  • Posts: 3
    • View Profile
    • Email
Drawing Methods Reference Out Of Place with Distortion ?
« on: July 18, 2024, 04:51:57 am »
Hello Friends,
When I execute this simple code:

#include <SFML/Graphics.hpp>

int main()
{
    sf::RenderWindow window(sf::VideoMode(200, 200), "SFML works!");
    sf::CircleShape shape(100.f);
    shape.setPosition(0.0f,0.0f);
    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;
}
 

I placed the result I've got in the attachments.

I'm using windows 10 and compiling with mingw:

g++ -c main.cpp -DSFML_STATIC
g++ main.o -o main -lsfml-graphics-s -lsfml-window-s -lsfml-system-s -lgdi32 -lopengl32 -lwinmm

And it gets worse, as you can see I've made the program self sufficient, no dll's needed, when I execute the EXACT SAME PROGRAM in another computer, it works.

Please guys, tell me, what's going on?

It is suppose to show a green circle, centered on the screen.

leowribeiro

  • Newbie
  • *
  • Posts: 3
    • View Profile
    • Email
Re: Drawing Methods Reference Out Of Place with Distortion ?
« Reply #1 on: July 18, 2024, 05:46:31 pm »
Actually, I just discovered that this problem has no relation to SFML, I made my simple program in raylib, another graphics library, and the same problem happens.

Any idea guys?

leowribeiro

  • Newbie
  • *
  • Posts: 3
    • View Profile
    • Email
Re: Drawing Methods Reference Out Of Place with Distortion ?
« Reply #2 on: July 18, 2024, 06:03:46 pm »
I've discovered what the problem was.
I'm using a notebook with a geforce graphics card and processor integrated intel graphics card.
Both drivers were activated in devices. When I deactivated the intel graphics card and left only the nvidia driver, it worked as expected.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
Re: Drawing Methods Reference Out Of Place with Distortion ?
« Reply #3 on: July 19, 2024, 02:35:59 pm »
You should be able to define the macro SFML_DEFINE_DISCRETE_GPU_PREFERENCE to hint that you want to use the discrete GPU.
Dual GPU systems usually also allow you to set preferences per application.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/