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

Author Topic: Transform matrix behaves differently for VertexArray and Text  (Read 1120 times)

0 Members and 1 Guest are viewing this topic.

pauljurczak

  • Newbie
  • *
  • Posts: 3
    • View Profile
Transform matrix behaves differently for VertexArray and Text
« on: December 24, 2019, 07:08:07 am »
In this code snippet:

    sf::Text      text{ "text", font };
    sf::Transform transform{ 1, 0, 0, 0, -1, 0, 0, 0, 1 };
    sf::View      view{ sf::FloatRect{-100, -100, 200, 200} };

    text.setFillColor(sf::Color::Red);
    view.setViewport(sf::FloatRect{0, 0, 1, 1});
    window.setView(view);
    window.draw(text, transform);

the text is being displayed upside-down as intended. When I change transform to:

sf::Transform transform{ 1, 0, 0, 0, -1, 0, 0, 0, 0 };

the text is not displayed any more. If I replace sf::Text with sf::VertexArray, vertices are displayed. Why there is a difference in behavior between these two Drawable types?
« Last Edit: December 24, 2019, 07:12:24 am by pauljurczak »

 

anything