Rendering the scene usually involves more than one shader program which, in my case, all use the same attributes and share at least some of the uniforms. To have them working properly, I currently play safe, meaning I rebind the attributes and get the appropriate uniform locations every time I switch between shader programs. So basically multiple times in every frame, which is probably not the best approach.
So, is it (in general) necessary to rebind attributes and uniforms after switching shader programs? And why?
If so, is there a way to do this once at start of the program and never have to touch them again (except for setting the uniform values)?