SFML community forums

Help => Graphics => Topic started by: Heryon on April 25, 2017, 09:09:42 pm

Title: Glsl::Vec2 from sf::Vector2f
Post by: Heryon on April 25, 2017, 09:09:42 pm
Hi, I'm using shaders in my app, and as setParameter is deprecated, I must use setUniform, but I don't know how to convert a sf::Vector2f into a Glsl::Vec2.
Title: Re: Glsl::Vec2 from sf::Vector2f
Post by: Hapax on April 25, 2017, 09:32:02 pm
Both sf::Vector2f and sf::Glsl::Vec2 are typedefs of sf::Vector2<float>.

You should be able to provide a sf::Vector2f as the parameter for setUniform.
Quote
setUniform's overloads support all the types provided by SFML:
[...]
sf::Vector2f (GLSL type vec2)
(from https://www.sfml-dev.org/tutorials/2.4/graphics-shader.php#passing-variables-to-a-shader)
Title: Re: Glsl::Vec2 from sf::Vector2f
Post by: Heryon on April 25, 2017, 09:34:55 pm
Ok thank you.