Allegro.cc - Online Community

Allegro.cc Forums » Allegro Development » allegro_gl_use_mipmapping()

This thread is locked; no one can reply to it. rss feed Print
allegro_gl_use_mipmapping()
Colin Duncan
Member #5,618
March 2005

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
Member #2,207
April 2002
avatar

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
Member #5,618
March 2005

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
Free Market Evangelist
September 2000
avatar

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.

--
- Bob
[ -- All my signature links are 404 -- ]

Steve Terry
Member #1,989
March 2002
avatar

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.

___________________________________
[ Facebook ]
Microsoft is not the Borg collective. The Borg collective has got proper networking. - planetspace.de
Bill Gates is in fact Shawn Hargreaves' ßî+çh. - Gideon Weems

Oscar Giner
Member #2,207
April 2002
avatar

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
Free Market Evangelist
September 2000
avatar

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.

--
- Bob
[ -- All my signature links are 404 -- ]

Steve Terry
Member #1,989
March 2002
avatar

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

___________________________________
[ Facebook ]
Microsoft is not the Borg collective. The Borg collective has got proper networking. - planetspace.de
Bill Gates is in fact Shawn Hargreaves' ßî+çh. - Gideon Weems

Oscar Giner
Member #2,207
April 2002
avatar

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
Member #1,989
March 2002
avatar

Makes no difference with or without glTexPareteri :-/

___________________________________
[ Facebook ]
Microsoft is not the Borg collective. The Borg collective has got proper networking. - planetspace.de
Bill Gates is in fact Shawn Hargreaves' ßî+çh. - Gideon Weems

Bob
Free Market Evangelist
September 2000
avatar

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.

--
- Bob
[ -- All my signature links are 404 -- ]

Go to: