I want to load 2 texture at the same time into my fragment shader:
in vec2 TexCoord;
layout (location = 0) out vec4 FragColor;
uniform sampler2D tex1;
uniform sampler2D tex2;
void main() {
FragColor = mix(texture(tex1, TexCoord),texture(tex2, TexCoord), 0.3);
}
I'm using SOIL library to do this:
GLuint tex1 = SOIL_load_OGL_texture("rock.bmp", SOIL_LOAD_AUTO,
SOIL_CREATE_NEW_ID, SOIL_FLAG_INVERT_Y);
GLuint tex2 = SOIL_load_OGL_texture("lena512.bmp", SOIL_LOAD_AUTO,
SOIL_CREATE_NEW_ID, SOIL_FLAG_INVERT_Y);
However only the second texture is showing up, not the first one. I realize that I need to perform glUniform1i somewhere attaching sampler2D tex1 to the first one and vice versa. How do I fix the problem?