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

Author Topic: Glsl::Vec2 from sf::Vector2f  (Read 1686 times)

0 Members and 1 Guest are viewing this topic.

Heryon

  • Newbie
  • *
  • Posts: 9
    • View Profile
Glsl::Vec2 from sf::Vector2f
« 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.

Hapax

  • Hero Member
  • *****
  • Posts: 3379
  • My number of posts is shown in hexadecimal.
    • View Profile
    • Links
Re: Glsl::Vec2 from sf::Vector2f
« Reply #1 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)
Selba Ward -SFML drawables
Cheese Map -Drawable Layered Tile Map
Kairos -Timing Library
Grambol
 *Hapaxia Links*

Heryon

  • Newbie
  • *
  • Posts: 9
    • View Profile
Re: Glsl::Vec2 from sf::Vector2f
« Reply #2 on: April 25, 2017, 09:34:55 pm »
Ok thank you.