Generally, my method for creating/using texture arrays works fine. However, I've noticed that the use of arrays seemingly negates my ability to use any textures that are not part of the array, even if loaded separately. Specifically, I'm trying to access my depth texture for a shadow map. If I bind the diffuse/normal/specular maps individually, and not part of the array, things render as expected. If I bind using an array, the shadow map is not accessible.
I'm wondering if binding the array overrides the non-arrayed shadow map or if I should be calling things differently.
I'm likely making a small mistake here, but is there a way to use both in a shader? The opengl docs don't mention this scenario.
pseudo-code example:
//binding
//shadow map
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, depthTexture);
glUniform1i(shadowMapID, 0);
//diffuse image
glActiveTexture(GL_TEXTURE1);
glBindTexture(GL_TEXTURE_2D_ARRAY, texturearray);
glUniform1i(LayerNumID1, imageIndex.x);
//normal map
glActiveTexture(GL_TEXTURE2);
glBindTexture(GL_TEXTURE_2D_ARRAY, texturearray);
glUniform1i(LayerNumID2, imageIndex.y);
//specular map
glActiveTexture(GL_TEXTURE3);
glBindTexture(GL_TEXTURE_2D_ARRAY, texturearray);
glUniform1i(LayerNumID3, imageIndex.z);
in fragment shader:
uniform sampler2DShadow shadowMap;
uniform sampler2DArray DiffuseTextureSampler;
uniform sampler2DArray NormalTextureSampler;
uniform sampler2DArray SpecularTextureSampler;
uniform int layer_index1;
uniform int layer_index2;
uniform int layer_index3;