SFML community forums

Help => Graphics => Topic started by: XLAT on October 25, 2021, 09:17:30 am

Title: Point not drawn in coordinates: (0,0)
Post by: XLAT on October 25, 2021, 09:17:30 am
There is a code like this:
        sf::VertexArray ap (sf::Points,1);
                        ap[0].color    = sf::Color::Green;
                        ap[0].position = sf::Vector2f (0,0);

                        window.draw(ap);
 

Why is the green point not drawn in coordinates: (0,0) ???
Title: Re: Point not drawn in coordinates: (0,0)
Post by: eXpl0it3r on October 30, 2021, 10:58:55 pm
Well it is, it's just that (0, 0) is essentially on the edge of your window.
What you expect is that the surface between (0, 0) and (1, 1) is being colored.
For that you need to move the point into the middle of that surface, thus the position required is actually (0.5, 0.5)
Title: Re: Point not drawn in coordinates: (0,0)
Post by: XLAT on November 02, 2021, 04:36:15 pm
I found the answer in
That the coordinate system in OpenGL is represented with the y-axis pointing up.
In SFML, the frustum was turned upside down,
So that the Y-axis is pointing down.
Because of this, everything that is on the X axis with y = 0 becomes invisible.