add anisotropic filtering, from forum user Laurens

This commit is contained in:
David Rose 2008-08-24 00:22:42 +00:00
parent 021dc6c13d
commit bf7eac8263
2 changed files with 19 additions and 0 deletions

View File

@ -1123,6 +1123,15 @@ reset() {
_num_active_texture_stages = 0;
// Check availability of anisotropic texture filtering.
if (has_extension("GL_EXT_texture_filter_anisotropic")) {
GLfloat max_anisotropy;
GLP(GetFloatv)(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &max_anisotropy);
_max_anisotropy = (float)max_anisotropy;
} else {
_max_anisotropy = 1.0;
}
report_my_gl_errors();
_supports_stencil_wrap = has_extension("GL_EXT_stencil_wrap");
@ -6702,6 +6711,15 @@ specify_texture(Texture *tex) {
GLP(TexParameteri)(target, GL_TEXTURE_MAG_FILTER,
get_texture_filter_type(magfilter, tex->get_format(), true));
// Set anisotropic filtering.
float anisotropy = tex->get_anisotropic_degree();
if (anisotropy > _max_anisotropy) {
anisotropy = _max_anisotropy;
}
if (anisotropy > 1.0) {
GLP(TexParameterf)(target, GL_TEXTURE_MAX_ANISOTROPY_EXT, anisotropy);
}
if (tex->get_format() == Texture::F_depth_stencil) {
GLP(TexParameteri)(target, GL_DEPTH_TEXTURE_MODE_ARB, GL_INTENSITY);
if (_supports_shadow_filter) {

View File

@ -401,6 +401,7 @@ protected:
GLuint _current_ibuffer_index;
GLuint _current_fbo;
int _num_active_texture_stages;
float _max_anisotropy;
int _error_count;