allegro_gl_use_mipmapping()
Colin Duncan

When I call allegro_gl_use_mipmapping(1), textures with sharp, straight lines tend to be rendered with a kind of antialiasing effect that makes them look blurry. I thought this might be down to the MAG and MIN filters, but whether they're set to GL_LINEAR or GL_NEAREST doesn't seem to make any difference. Is there some way round this (using the GLUT commands, perhaps?), or am I doomed to write my own mipmapping routines?

Thanks in advance!

Oscar Giner

Mipmaping will make the textures look blurry at a distance in polygons near perpendicular to the observer (like the floor). That's how mipmaping works, and there's no way around that.

A posible solution is using anisotropic filtering. But it consumes more resuorces and it's not supported be older hardware. I have no idea how to use AF in OpenGL, though.

Colin Duncan

Thanks, Oscar. I could try using mipmaps only for walls, then, but it's the floor that would benefit most from it. Is there some way to change the distance at which each mipmap level is displayed? At the moment, even textures very close to the camera look blurry. It's only these that are the problem, in fact: textures in the distance look much nicer with mipmapping on rather than off.

Bob

Check the texture quality settings in your control pannel. Some other video card manufacturers have a tendency to lower the rendering quality when they detect certain usage patterns.

Mipmapping should not make any difference when LINEAR or NEAREST minimification filtering is used.

Quote:

Is there some way round this (using the GLUT commands, perhaps?), or am I doomed to write my own mipmapping routines?

AllegroGL will use the GLUT routines when it can, and use its own when it can't.

Steve Terry

I was gonna say the same thing: See attached.
I guess there is indeed no way around it :-/ I'll check the control panel though for quality settings.

Oscar Giner

Try forcing anisotropic filtering in your videocard driver panel. For nVidia, it should be in "Quality and performance configuration", and you can force it for all programs or a specific one.

Bob
Quote:

Try forcing anisotropic filtering in your videocard driver panel.

You should not do that. A lot of games are incompatible with anisotropic filtering (or show curroption), so you should not usually force this setting.

One thing you should check is weather or not your textures are power-of-2 sized. The texture conversion routines in AGL were ill-defined for those cases. You really should use allegro_gl_make_texture_ex() instead of allegro_gl_make_texture().

Quote:

I guess there is indeed no way around it

As an experiment (please don't leave this code in your final product), try setting the LOD bias to -1:

glBindTexture(...);
glTexParameteri(..., GL_TEXTURE_LOD_BIAS, -1);

If it helps make the mipmapped case look like the non-mipmapped case, then you are looking at a driver bug.

Steve Terry

tex = allegro_gl_make_texture_ex (AGL_TEXTURE_MIPMAP, texture, -1);
Is what I used... is that wrong?

Oscar Giner

Did you also cal

glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);

It seems that AllegroGL sets it to GL_NEAREST_MIPMAP_NEAREST, which looks worse.

Steve Terry

Makes no difference with or without glTexPareteri :-/

Bob
Quote:

It seems that AllegroGL sets it to GL_NEAREST_MIPMAP_NEAREST, which looks worse.

Does not.

Quote:

Is what I used... is that wrong?

That's fine

Quote:

Makes no difference with or without glTexPareteri :-/

Try biasing the LOD, like I mentioned above.

Thread #470011. Printed from Allegro.cc