sgsrules's picture

Anisotropic Filtering in OpenGL 3.2

I used to use Anisotropic filtering but can't figure out where the GL_TEXTURE_MAX_ANISOTROPY_EXT enum is in opentk.

glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, maxAnisotropy);


Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
sgsrules's picture

Nevermind I found it =P

In case anyone else gets lost:

 float maxAniso;
 GL.GetFloat((GetPName) ExtTextureFilterAnisotropic.MaxTextureMaxAnisotropyExt, out maxAniso);
  GL.TexParameter(TextureTarget.Texture2D, (TextureParameterName) ExtTextureFilterAnisotropic.TextureMaxAnisotropyExt, maxAniso);
ZTK's picture

Thanks, I was looking for this!

Rhedox's picture

I know this thread is a few days old but I thought I'd rather answer than creating a new one.

AF doesn't work for me. The snippet breaks the texture but I don't get a GL_Error.

the Fiddler's picture

Try setting the anisotropic filtering level before calling GL.TexImage2D. Some drivers are picky (hi, AMD).

Moreover, try using an integer, not floating point number for the max anisotropy parameter:

var extensions = GL.GetString(StringName.Extensions).Split(' ');
if (extensions.Contains("GL_EXT_texture_filter_anisotropic"))
{
    int max_aniso = GL.GetInteger((GetPName)ExtTextureFilterAnisotropic.MaxTextureMaxAnisotropyExt);
    GL.TexParameter(
       TextureTarget.Texture2D,
       (TextureParameterName)ExtTextureFilterAnisotropic.TextureMaxAnisotropyExt,
       max_aniso);
}