why texture linear filtering doesnt work in 3.1?

glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR );

i have these lines just before glTexImage2D
and textures are filtered the same ugly way like GL_NEAREST do
both under win xp and 7

btw i program an image browser so textures are in fact images, that can be big
like 1920x1200

and performance also sucks.
i tried dx10 it handles hundred thumbnails with ease.
but with opengl i cant scroll the window with thumbs without stuttering.

can anybody help?

Typo ? second line should read _MAX_FILTER, right ?

glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );

LINEAR MIN filter means no mipmaps used, so it will be both slow and ugly when big images will be shown as a small thumbnail.
Try
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR); for best quality (trilinear filtering), or GL_LINEAR_MIPMAP_NEAREST if your card is slow.

In either case, do not forget to either provide mipmap levels by hand to GL, or generate them with glGenerateMipmap();

It’s GL_TEXTURE_MAG_FILTER and glGenerateMipmap, no s.

yes, it was typo.
i think i dont need mipmaps since i need only fixed size thumbnails.

i can render to FBO’s texture i guess to make small thumbnail textures.

but again i dont understand:

  1. why GL_LINEAR doesnt work. (it’s ovbious, GL_NEAREST is applied).
  2. why even this errorneous GL_NEAREST appliance is so slow.
    (since directx10 with linear filtering works fine even with big images).

and this happens both under win xp & 7.
maybe opengl has some restriction on appying trilinear filtering?

Are you using texture rectangles by any chance?

i think i dont need mipmaps since i need only fixed size thumbnails.

1920x1200 is quite a thumbnail :slight_smile:

  1. Can you post a screenshot ?
    You can’t see a difference between nearest and linear filtering on a very reduced texture.
  2. Both linear and nearest are also very slow in the MIN case, because texture access becomes very hard to cache (the whole 1920x1200 texture is sampled almost randomly). Nearest only have a performance advantage when used on MAG filtering.

maybe opengl has some restriction on appying trilinear filtering?

Say again ? By using MIN: LINEAR, you explicitely disabled trilinear filtering !
To get trilinear, use MIN: LINEAR MIPMAP LINEAR, and glGenerateMipmap(), it will be much better and faster.

ok, you say i’m disabling triliner filtering with glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR );?

it’s wrong algo for minification?
so why dx10 gives smooth thumbnails with
SamplerState mySampler{
Filter = MIN_MAG_MIP_LINEAR;
};

about screenshots - no sense to upload.

MIN_MAG_MIP_LINEAR in dx10 gives smooth thumbnails
while GL_LINEAR doesnt work.

MIN_MAG_MIP_LINEAR in dx10 gives smooth thumbnails
while GL_LINEAR doesnt work.

Did you even read what ZbuffeR said? Setting the min filter to GL_LINEAR is not the same thing as setting MIN_MAG_MIP_LINEAR in D3D. You have to set the min filter to GL_LINEAR_MIPMAP_LINEAR like he said.

Yeah thank you Alfonse, I started to feel alone talking to a wall…

For the last time, D3D10_FILTER_MIN_MAG_MIP_LINEAR is equivalent to MIN:GL_LINEAR_MIPMAP_LINEAR+MAG:GL_LINEAR.

ok, understood )
thanx, guys