About Mag and Min Filter

now i want to test when will openGL use Mag or Min filter. I use the following test:

My texture is a 64*64 pics and the filter setting
is as followed:
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER, GL_NEAREST);

and the perspective setting :
(1)
gluPerspective(60.0, (GLfloat) w/(GLfloat) h, 1.0, 10.0);
glBegin(GL_QUADS);
glTexCoord2f(0.0, 0.0);
glVertex3f(-2.0, -1.0, 0.0);
glTexCoord2f(0.0, 1.0);
glVertex3f(-2.0, 1.0, 0.0);
glTexCoord2f(1.0, 1.0);
glVertex3f(0.0, 1.0, 0.0);
glTexCoord2f(1.0, 0.0);
glVertex3f(0.0, -1.0, 0.0);
glEnd();

the polygon is 2*2

(2)
gluPerspective(60.0, (GLfloat) w/(GLfloat) h, 150.0, 3000.0);
glBegin(GL_QUADS);
glTexCoord2f(0.0, 0.0);
glVertex3f(-80.0, -80.0, -200.0);
glTexCoord2f(0.0, 1.0);
glVertex3f(-80.0, 80.0, -200.0);
glTexCoord2f(1.0, 1.0);
glVertex3f(80.0, 80.0, -200.0);
glTexCoord2f(1.0, 0.0);
glVertex3f(80.0, -80.0, -200.0);
glEnd()

the polygon is 160*160

the two results are all linear, and i don’t know why. Can anyone tell me the reason?
(I think the first one will be nearest…)

Thank you !!

In both cases, the size of the quad in screen space is larger than the size of the texture, so it’s magnification in both cases.

Magnification occurs when the size of a texel is larger than a pixel, i.e. the texel is magnified. Minification is the other way around, when the size of a texel is smaller than a pixel.

Let’s take the second one as an example. In a 300x300 window, the second quad is about 200x200 pixels large. The texture is only 64x64 texels large, so a texel ends up covering about 200/64 which is approx. 3 pixels.

If you want to see the minification filter, you have to make the quad smaller than the texture. Smaller in screen space that is, not smaller in OpenGL-units.

Thanks
So, does it mean that if my quad’s original size is 200200, and after perspective it becomes 3030 in screen space. Then when i use 64*64 texture, it will use minification filter?

I’d like to ask another question. What is the unit of mag. or min. filter? A polygon or a pixel?
If a large polygon across large z value, maybe the near part of the polygon’s texels are larger than pixels, and the far part of the polygon are another condition. Are all pixels in this polygon are in the same filter(nearest or linear), or every pixel will have different condition?

THX

So, does it mean that if my quad’s original size is 200200, and after perspective it becomes 3030 in screen space. Then when i use 64*64 texture, it will use minification filter?

Yes, that is correct. Texture filtering have nothing to do with the size of the object in units when you give OpenGL the cooridnates, and everything to do with how many pixels the objects covers on screen.

What is the unit of mag. or min. filter? A polygon or a pixel?

Texture filtering are per pixel. Different parts can have different filtering modes as pixel:texel cover ratio changes.