Shared Uniforms

Can I share Uniform variables between different shader programs?

I don’t want to set uniforms such as cameraPosition seperately for each program.

-Hannes

You can use a UBO (uniform buffer object) or a TBO (texture buffer object) or any old texture.

Camera position might not be the best example because it’s always 0,0,0 :wink: (in eye-space anyway).

Thanks! UBO is what I was looking for.

And I also reaslised that camera position is implicitly defined in my view matrix anyway :).