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

Author Topic: Point not drawn in coordinates: (0,0)  (Read 7016 times)

0 Members and 1 Guest are viewing this topic.

XLAT

  • Newbie
  • *
  • Posts: 2
    • View Profile
Point not drawn in coordinates: (0,0)
« 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) ???
« Last Edit: October 25, 2021, 09:27:05 am by XLAT »

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11032
    • View Profile
    • development blog
    • Email
Re: Point not drawn in coordinates: (0,0)
« Reply #1 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)
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

XLAT

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: Point not drawn in coordinates: (0,0)
« Reply #2 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.

 

anything