I have a question, is it a good idea to change shaders for the node on the fly?
I have a RenderTexture that most of the time is plain, yet when times come for the explosion to occur it runs quite costly displacement shader to render a shockwave. And I want to turn it of when its not needed (it has already enough If statements in it, I don’t want to add more).
I wonder if change of the shader programm operation is costly and if swaping shaders on the fly is a good idea or bad?
changing shader program is quite cheap. Cocos2dx internally calls CCGLProgram::use to change shader program for different types of nodes. So, I don’t think that calling that function one more time (in several thousands of frames) won’t affect performance at all.