View Full Version : Shared Uniforms

09-09-2010, 01:43 PM
Can I share Uniform variables between different shader programs?

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


Dark Photon
09-09-2010, 06:18 PM
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 ;) (in eye-space anyway).

09-11-2010, 07:03 AM
Thanks! UBO is what I was looking for.

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