Hello,
I’m starting to learn more about shader programming with GLSL, but in my “studies” these 2 questions came up:
-
Inside some Vertex Shader there’s an Uniform array of Mat4’s, which has about some 32 elements.
Do I really need to map every single slot of that array using the “glGetUniformLocation()” and then later manually submit a matrix for every slot of this Uniform, or I can just submit a same-sized array of matrices at once? -
If I have different meshes with different shaders “applied” (meaning, I want to use different shaders for different meshes), how would I change which shader to use?
Would I need to:
- Disable the current program using glUseProgram(0) first, and then use a different program (in other words, is it really necessary to put a NULL program before changing between programs), or…
- Simply use glUseProgram(n) and put a different program number (is that going to automatically change which type of program the renderer will use? isn’t there going to be a left over leak from the previously used program or something?).
Thanks for reading.