<p>Array textures do not contain textures; they are a single texture that contains a number of images, with each image being of the same size, format, mipmap depth, etc.</p>

<p>As such, the <a href="https://www.khronos.org/opengl/wiki/Texture#Texture_Objects" rel="nofollow noreferrer">sampling parameters that are part of the texture</a> apply to sample fetches for all images within the texture.</p>

<p>That having been said:</p>

<blockquote>
  <p>In the shader I perform a manual GL_NEAREST lookup via textureFetch().</p>
</blockquote>

<p>This means your FS knows when to look the texture up with linear filtering and when not to. As such, you could have two different array texture samplers in the shader, one of which you expect to use linear sampling and one which uses nearest.</p>

<p>Both of these samplers can be using the same texture object, just paired with a different <em><a href="https://www.khronos.org/opengl/wiki/Sampler_Object" rel="nofollow noreferrer">sampler object</a></em> (which contains all of the filtering parameters for the texture). One sampler would use nearest filtering, the other would use linear.</p>

CC BY-SA 4.0
2020-02-04T06:06:29.833Z
2020-02-04T06:06:29.833Z
Nicol Bolas
<p>Currently I have textures which need GL_NEAREST and some other need GL_LINEAR in the same texture2dArray. In the shader I perform a manual GL_NEAREST lookup via textureFetch().</p>

<p>To avoid this my question is, is it possible to set the value of GL_TEXTURE_MIN/MAG_FILTER for each texture in a texture array to different values?</p>

<p>I know of the same size restrictions, but could not find anything regarding mipmapping.</p>

<opengl><texture><3dtexture><mipmap>
2D array texture with different filtering setting per texture?
MrRabbit
# 2D array texture with different filtering setting per texture?

(Asked by: username_0 on 2020-02-03)

Currently I have textures which need GL\_NEAREST and some other need GL\_LINEAR in the same texture2dArray. In the shader I perform a manual GL\_NEAREST lookup via textureFetch().

To avoid this my question is, is it possible to set the value of GL\_TEXTURE\_MIN/MAG\_FILTER for each texture in a texture array to different values?

I know of the same size restrictions, but could not find anything regarding mipmapping.

**Tags:** opengl, texture, 3dtexture, mipmap


---

## 1 answers

### Answer by username_1 on 2020-02-04. Score: 3 | Accepted answer

Array textures do not contain textures; they are a single texture that contains a number of images, with each image being of the same size, format, mipmap depth, etc.

As such, the [sampling parameters that are part of the texture](https://www.khronos.org/opengl/wiki/Texture#Texture_Objects) apply to sample fetches for all images within the texture.

That having been said:

> In the shader I perform a manual GL\_NEAREST lookup via textureFetch().

This means your FS knows when to look the texture up with linear filtering and when not to. As such, you could have two different array texture samplers in the shader, one of which you expect to use linear sampling and one which uses nearest.

Both of these samplers can be using the same texture object, just paired with a different *[sampler object](https://www.khronos.org/opengl/wiki/Sampler_Object)* (which contains all of the filtering parameters for the texture). One sampler would use nearest filtering, the other would use linear.


---

