I have a shader that has a number of global parameters / variables. Most of them are static and do not need to change after the effect is created. I set them after the effect is created and don’t set them again during the draw function.
This worked fine for DirectX i.e. I never had a problem with my shader working as expected.
I recently tested an OpenGL build of my app, and ran into problems. It seems that binding the effect parameters early (i.e. outside the draw) does not seem to work well on OpenGL. Some of the values (it’s unpredictable as to which) don’t seem to be passed through during the draw stage.
If I bind the parameters again during the draw calls, all works as expected. Note, setting it during the update doesn’t work either… it has to be set during the draw.
Are all shader parameters supposed to be bound / set every time during every draw call? If not, then this might be an OpenGL bug… if so, then I guess my understanding of this was incorrect (and DirectX was more forgiving and still worked correctly).