Is there any way to activate shader uniforms as they’re bound? Basically for having 2 different shader programs without activating the uniforms for each, every time its bound. I’m thinking of a hash map of method objects (Reflection), every time the shader is bound, it iterates through them and calls each one. ( I just thought of this on the spot, I may be wrong on how to do this)
Why are you trying to do this? We can help you out more this way
And I hate to be the one to do this, but it’s “as they’re bound”. Don’t take this as an insult, I’m just trying to help you out. If you make a mistake like that on a resume or something, it looks silly.
I’m trying to make a lighting system. I basically just need a way to setup the uniforms during the shader initialization.
Basically, there is a list of lights, each one having a different shader. Each ‘game object’ (entity, or thing) is rendered with a shader parameter, then binds it, and calls its sub-classes abstract render stuff. This makes it easy for multi-render passes for different shading techniques. (Like an initial pass for ambient light/textures, then one for light boxes, then one for post-processing or something.)
S***, my bad. :clue: My obnoxious cousin is playing a game next to me and he loves to over exaggerate everything. Kinda hard to focus on anything with him constantly yelling.
Well shaders don’t really work like that. Each time you run the shader on another object, it runs completely afresh. Are you trying to do something like a static variable?
Also, why not just pass the uniforms in each render? That’s the way you’re supposed to do it.
I guess I could just make each light’s class initialize its shaders uniforms during its ‘bind’ and ‘unbind’ functions. That shouldn’t be too messy. Thanks anyway!
No problem
I just don’t really see a way to do what you’re trying to do, because that’s simply not how shaders work.