I've tried looking everywhere, but I just don't get it. How is multiple shaders assigned to a mesh if you can only bind a single shader in OpenGL?
Assume I have a mesh with a texture shader and now I do a ray-cast from the mouse position to select the object from the editor. In this case I would like to apply a selection shader that highlights that the mesh is selected, but still preserves the texture shader of the mesh.
I want to apply the selection shader on top of the texture shader of the mesh. How is this generally done in game engines?
One way of doing this would be to make a completely third shader that is combination of both shaders and just apply the third shader. But that doesn't seem efficient and would become tedious when trying to add new shaders; now you have to specify a selection shader for every shader in the game, in case it's selected in the editor.
Any help is appreciated and if you can guide to some reading material that would be amazing.