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

Author Topic: sf::Shader uniform array  (Read 3492 times)

0 Members and 2 Guests are viewing this topic.

bmn

  • Newbie
  • *
  • Posts: 18
    • View Profile
sf::Shader uniform array
« on: June 19, 2012, 07:58:35 pm »
How do I send data to uniform array with sf::Shader ? I've tried using this:
float v3Colours[30];
for( int i = 0; i < 10; i++ ){
        v3Colours[ i * 3    ] = i*0.1;
        v3Colours[ i * 3 + 1] = 1.0-i*0.1;
        v3Colours[ i * 3 + 2] = 1.0-i*0.1;
}
glUniform3fv(glGetUniformLocation(id, "v3Colours"), 10, v3Colours);
but I don't know program id. Is it even possible ?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: sf::Shader uniform array
« Reply #1 on: June 19, 2012, 08:11:59 pm »
Quote
Is it even possible ?
Nop.
Laurent Gomila - SFML developer

bmn

  • Newbie
  • *
  • Posts: 18
    • View Profile
Re: sf::Shader uniform array
« Reply #2 on: June 19, 2012, 08:18:47 pm »
But you mean its not possible in sfml or in glsl itself. This is how I got code above
http://stackoverflow.com/questions/8099979/glsl-c-arrays-of-uniforms

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: sf::Shader uniform array
« Reply #3 on: June 19, 2012, 08:24:46 pm »
This is not possible with SFML, but if you had the program ID (which is not possible with SFML) you could make your code work.
Laurent Gomila - SFML developer

bmn

  • Newbie
  • *
  • Posts: 18
    • View Profile
Re: sf::Shader uniform array
« Reply #4 on: June 19, 2012, 08:31:20 pm »
Oh ok, thanks. New feature in 2.x ? ;D

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: sf::Shader uniform array
« Reply #5 on: June 19, 2012, 10:46:15 pm »
sf::Shader will probably be improved, yes.
Laurent Gomila - SFML developer

 

anything