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

Author Topic: Deprecated setParameter (sf::Shader) equivalent  (Read 3474 times)

0 Members and 1 Guest are viewing this topic.

korczurekk

  • Full Member
  • ***
  • Posts: 150
    • View Profile
    • Email
Deprecated setParameter (sf::Shader) equivalent
« on: October 18, 2016, 08:39:18 pm »
Hi,
I've updated my SFML to 2.4 and realised that sf::Shader::setParameter is deprecated. I tried to remove it from my code:
transform.rotate(36.f * deltaTime.asSeconds(), {0.f, 0.f});
shader.setParameter("matrix", transform);
 
And wrote that:
transform.rotate(36.f * deltaTime.asSeconds(), {0.f, 0.f});
shader.setUniform("matrix", transform.getMatrix());
 
But nothing is being drawn. I mean, background is cleared normally, but transformed vertices areā€¦ somewhere.

What can be the problem?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Deprecated setParameter (sf::Shader) equivalent
« Reply #1 on: October 18, 2016, 09:15:37 pm »
Should be

shader.setUniform("matrix", sf::Glsl::Mat4(transform));

However your code calls an overload of setUniform with a const float* argument, and I can't find which one is chosen -- but most likely the wrong one if it doesn't work like before. This could be an issue of the new API.
Laurent Gomila - SFML developer

korczurekk

  • Full Member
  • ***
  • Posts: 150
    • View Profile
    • Email
Re: Deprecated setParameter (sf::Shader) equivalent
« Reply #2 on: October 18, 2016, 10:25:08 pm »
Thanks, it works well now. :)