I am trying to output the result of a fragment shader to two different outputs (frame buffer objects).
As far as the shader is concerned, I learned I can specify the different targets as :
layout (location = x) out vec4 color;
layout (location = y) out vec4 miscData;
Now the question being : how do I specify these locations C++ side ? So that my two FBO's match the shader's output indexes ? I have an example of it for the vertex shader in Nicol Bolas' book, but didn't read far enough to the fragment shader parts - so I don't know if he covers this subject or not.
Just as another trivia question : I've read the texture indexes are at least 48 (TEXTURE0, TEXTURE1, etc...) and that you don't exceed this even in the most extreme graphic apps. How come ? Is it because you generally don't use more that 48 textures at the same time in a fragment shader ? I must be missing something very obvious because, obviously, modern games use hunderds if not thousands of different textures.
Finally, does texture indexes (TEXTURE0, TEXTURE1, ...) have anything to do with layout locations ?