mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-02 09:52:27 -04:00
fix anisotropy bug
This commit is contained in:
parent
1bf4b62746
commit
179fcf2cf0
@ -1266,12 +1266,13 @@ reset() {
|
||||
_num_active_texture_stages = 0;
|
||||
|
||||
// Check availability of anisotropic texture filtering.
|
||||
_supports_anisotropy = false;
|
||||
_max_anisotropy = 1.0;
|
||||
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;
|
||||
_supports_anisotropy = true;
|
||||
}
|
||||
|
||||
report_my_gl_errors();
|
||||
@ -7761,13 +7762,12 @@ specify_texture(CLP(TextureContext) *gtc) {
|
||||
get_texture_filter_type(magfilter, true));
|
||||
|
||||
// Set anisotropic filtering.
|
||||
float anisotropy = tex->get_effective_anisotropic_degree();
|
||||
if (anisotropy > _max_anisotropy) {
|
||||
anisotropy = _max_anisotropy;
|
||||
}
|
||||
if (anisotropy > 1.0) {
|
||||
if (_supports_anisotropy) {
|
||||
float anisotropy = tex->get_effective_anisotropic_degree();
|
||||
anisotropy = min(anisotropy, _max_anisotropy);
|
||||
anisotropy = max(anisotropy, 1.0f);
|
||||
GLP(TexParameterf)(target, GL_TEXTURE_MAX_ANISOTROPY_EXT, anisotropy);
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef OPENGLES
|
||||
if (tex->get_format() == Texture::F_depth_stencil ||
|
||||
|
@ -435,6 +435,7 @@ protected:
|
||||
GLuint _current_fbo;
|
||||
int _num_active_texture_stages;
|
||||
float _max_anisotropy;
|
||||
bool _supports_anisotropy;
|
||||
|
||||
int _error_count;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user