diff options
Diffstat (limited to 'source/blender/gpu/intern/gpu_draw.c')
-rw-r--r-- | source/blender/gpu/intern/gpu_draw.c | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/source/blender/gpu/intern/gpu_draw.c b/source/blender/gpu/intern/gpu_draw.c index 7dfbc52819e..87d25ac850a 100644 --- a/source/blender/gpu/intern/gpu_draw.c +++ b/source/blender/gpu/intern/gpu_draw.c @@ -246,8 +246,9 @@ static struct GPUTextureState { int domipmap, linearmipmap; int alphamode; + float anisotropic; MTFace *lasttface; -} GTS = {0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, 1, 0, -1, NULL}; +} GTS = {0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, 1, 0, -1, 1.f, NULL}; /* Mipmap settings */ @@ -292,6 +293,26 @@ static GLenum gpu_get_mipmap_filter(int mag) } } +/* Anisotropic filtering settings */ +void GPU_set_anisotropic(float value) +{ + if (GTS.anisotropic != value) + { + GPU_free_images(); + + /* Clamp value to the maximum value the graphics card supports */ + if (value > GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT) + value = GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT; + + GTS.anisotropic = value; + } +} + +float GPU_get_anisotropic() +{ + return GTS.anisotropic; +} + /* Set OpenGL state for an MTFace */ static void gpu_make_repbind(Image *ima) @@ -559,6 +580,8 @@ int GPU_verify_image(Image *ima, ImageUser *iuser, int tftile, int compare, int ima->tpageflag |= IMA_MIPMAP_COMPLETE; } + if (GLEW_EXT_texture_filter_anisotropic) + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, GPU_get_anisotropic()); /* set to modulate with vertex color */ glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); |