Reputation: 6857
I'm trying to move into the 'modern' OpenGL. I think I understand so far the concept of shader
s and I know how to compile them, but I'm not sure about when it is good to do it.
Is it ok to have a function that would compile all shader
s at the application start up, store them in some kind of manager, which would serve currently needed shader
?
Or maybe should I just compile them when they are needed and the next time they're needed just use the one I've already created?
And I assume that creating a shader program
every frame is not a good idea.
I'd appreciate any hints about it how to organise it in a good way.
Upvotes: 4
Views: 242
Reputation: 162164
Is it ok to have a function that would compile all shaders at the application start up, store them in some kind of manager, which would serve currently needed shader?
Yes. This is one of those one-time initialization things that could be regarded as OpenGL "initialization".
Upvotes: 2