1
Graphics / Transform matrix behaves differently for VertexArray and Text
« on: December 24, 2019, 07:08:07 am »
In this code snippet:
the text is being displayed upside-down as intended. When I change transform to:
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?
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);
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?