1

In OpenGL ES 2.0, is it possible to use a compiled vertex/fragment shader in multiple linked programs?

For example, let's say I have 1 compiled vertex shader and 5 compiled fragment shaders. Can I create 5 different programs(vsh1+fsh1, vsh1+fsh2, etc)?

As far as my knowledge goes, this should be possible but it never hurts to ask.

Thanks

Andrei Stanescu
  • 6,353
  • 4
  • 35
  • 64

1 Answers1

2

Yes, you can, but as I understand it you will still have to set all the uniforms separately. I think this is why the separable programs were born but you don't have access to them in Es 2.0 (it's a OpenGL 4.0 feature) so I think this is the only way.

Some discussion about it here.

Miki de Arcayne
  • 538
  • 1
  • 7
  • 15
  • 1
    Yes, setting the uniforms&attributes is done on the program so it makes sense to have to set them for each of them (even though some uniforms are used in the same vertex shader). Thanks – Andrei Stanescu Nov 25 '11 at 11:35