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

Author Topic: The new sf::shader additions  (Read 2209 times)

0 Members and 1 Guest are viewing this topic.

Phynx

  • Newbie
  • *
  • Posts: 2
  • Developer of Victum Terra
    • View Profile
    • Twitter for Victum Terra
The new sf::shader additions
« on: May 27, 2016, 09:47:11 pm »
I just had to register and say thanks for the new features that was added to sf::shader, being able to set array uniforms is what I've needed for awhile.
was wondering about being able to set custom struct arrays, would that be possible now?

ex:

#define MAX_LIGHTS 32

struct Light{
vec3 position;
vec4 color;
};

uniform Light sceneLights[MAX_LIGHTS];
One and only developer of Victum Terra, a roguelike platformer rpg terraria like game crushed up into one mass of code

fallahn

  • Sr. Member
  • ****
  • Posts: 492
  • Buns.
    • View Profile
    • Trederia
Re: The new sf::shader additions
« Reply #1 on: May 28, 2016, 09:22:02 am »
Aye the new interface is far more useful than the now deprecated one. As far as I can tell opengl itself doesn't provide a way to supply struct data unless you directly address its members like this or this. If you prefer, and you can ensure an opengl > 3 context, I have found uniform buffers can work well with SFML.

Phynx

  • Newbie
  • *
  • Posts: 2
  • Developer of Victum Terra
    • View Profile
    • Twitter for Victum Terra
Re: The new sf::shader additions
« Reply #2 on: May 30, 2016, 05:39:55 pm »
Thanks, I will need to look into those for sure since with any sfml build newer than the stable 2.3.2 I run into a stack overflow when loading textures in a thread
One and only developer of Victum Terra, a roguelike platformer rpg terraria like game crushed up into one mass of code