Hello All,

I needed some clarification regarding where exactly the filtering happens in OpenGL.
So, as per what i understand, we interpolate tex-coords from vertex to fragment shader. These vertices are used to sample a color(texel) from the texture.
When we sample using texture2D() in the fragment shader, this is where the filtering technique is applied.

1) GL_NEAREST: texture2D() returns the color at the appropriate tex-coord
2) GL_LINEAR : texture2D() averages color(texel) values from neighboring texels and returns the value.
And so on, with other filtering techniques.

Is this understanding correct? Or is there some other way the driver does the sampling of colors from the texture and returns the value?
Can anyone please clarify this for me?