I have a problem using texture array, when I tried it looks with blur, but when I use it as a single texture looks excellent (I am testing just with one texture to compare the quality), I am using the exactly same filtering steps for each process.
Here the code when I load as a single:
glGenTextures(1, &texture);
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, texture);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_MIRRORED_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_MIRRORED_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, max_anisotropy_value);
unsigned char *data = stbi_load(filePath, &width, &height, &nrChannels, 0);
if (data)
{
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, width, height, 0, GL_RGB, GL_UNSIGNED_BYTE, data);
glGenerateMipmap(GL_TEXTURE_2D);
}
And Here when I load as a texture array:
glGenTextures(1, &my_texture);
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D_ARRAY, my_texture);
glTexStorage3D(GL_TEXTURE_2D_ARRAY,
5 // I tested from 0 to 10 and clearly with each increase value blur increases!!,
preformat,
resolution, resolution,
(GLsizei)files_.size()
);
glTexParameteri(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_WRAP_S, GL_MIRRORED_REPEAT);
glTexParameteri(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_WRAP_T, GL_MIRRORED_REPEAT);
glTexParameteri(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
glTexParameteri(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, max_anisotropy_value);
for (GLuint i = 0; i < files_.size(); i++)
{
if (data[i])
{
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D_ARRAY, my_texture);
glTexSubImage3D(GL_TEXTURE_2D_ARRAY,
0, //Mipmap number
0, 0, i, //xoffset, yoffset, zoffset
resolution, resolution, 1, //width, height, depth
format, //format
GL_UNSIGNED_BYTE, //type
data[i]); //pointer to data
stbi_image_free(data[i]);
}
}
glBindTexture(GL_TEXTURE_2D_ARRAY, my_texture);
glGenerateMipmap(GL_TEXTURE_2D_ARRAY);
that’s is normal?

