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