Advertisement

Texture Filtering (Bilinear/Trilinear...)

Started by January 04, 2002 08:44 AM
0 comments, last by Crash_Kid 23 years, 1 month ago
Hi there, How can I enable Bilinear/Trilinear/Anisotropic filtering ? Or is it enabled automatically ? Thx
Those are all texture filters. Bilinear and Trilinear filtering is specified using the function:
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, filter ); 


For Bilinear filtering, "filter" must be GL_LINEAR_MIPMAP_NEAREST, and for Trilinear filtering, it must be GL_LINEAR_MIPMAP_LINEAR.

Anisotropic filtering can be enabled via an extension called "GL_EXT_texture_filter_anisotropic".

There are 2 new tokens added with this extension, these are:
#define GL_TEXTURE_MAX_ANISOTROPY_EXT			 0x84fe#define GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT		 0x84ff 


To enable anisotropic filtering, you use the glTextParameterf function like so:
glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, anisotropy ); 


Where anisotropy is >= 1. Note that an anisotropy of 1 is just the same as (bi)(tri)linear filtering. Anisotropic filtering can be used with either bilinear or trilinear filtering.

You can get your cards maximum anisotropy by using:
glGetTexParameterfv( GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, &max_anisotropy ); 


I don''t really know what the other token ( "GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT" ) means, so you''ll have to look it up somewhere ( the extension spec never really said much about it ).

Hope that helps!

Death of one is a tragedy, death of a million is just a statistic.
If at first you don't succeed, redefine success.

This topic is closed to new replies.

Advertisement