This is related to Switch shader program in WebGL, but I wanted to re-ask the question now I have a clearer idea of the problem and what I want to ask.
I’m trying to switch between different shader programs, but I can’t seem to get things to render correctly when switching shader program in the same render. I think there is state lost or reset after calling glUseProgram().
What state is lost or reset after that call? In other words, what do I need to bind again after glUseProgram()?
It is possible, that your vertex arrays and vertex attrib arrays have different locations in other programs (such as
this.locATex), same problems can occur with texture bindings and sampler uniforms for example. You need to query those attrib locations and ‘texture unit uniforms’, which you need to initialize yourself, for each program individually and bind your arrays and textures accordingly before drawing. Further bindings ‘at the other end’ can also break, such as fragment data locations. But i suggest, you provide some more code before new problems were invented :-).