Reputation: 1284
I am able to generate mipmaps using glGenerateMipMap and I am using min_filter gl_linear_mipmap_linear.
Without mipmaps the texture looks fine when displayed around the same size as the actual texture size (512x512) (as expected) but shows aliasing effects when I zoom out (as expected).
With mipmaps the texture looks fine when displayed around the same size as the actual texture size (512x512) (as expected) and does not show aliasing effects when I zoom out (as expected). HOWEVER, I get ugly blurry textures that makes the mipmap version unusable to the point I may as well put up with the aliasing.
Any idea what I may be doing wrong here? I do not know if the generated mipmaps are ending up looking like that or whether a mipmap too small is being selected when it should be choosing a larger one. Has anyone actually got good results using glGenerateMipMap on OpenGL ES 2.0 on iOS?
Upvotes: 0
Views: 2054
Reputation: 2022
Try setting hint to generate nice mipmaps, this could affect what filter is used to generate them, but no guarantee since effect is implementation-dependent.
glHint(GL_GENERATE_MIPMAP_HINT, GL_NICEST)
you can also affect resulting blurriness by setting lod bias in your texture sampling code.
To get best results you can use anisotropy if this extension is supported. Run this alongside with setting magnification and minification filters:
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, 2.0);
instead of 2.0 you can acquire max anisotropy level and set anything bellow it:
glGetFloatv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &maxAniso);
Upvotes: 2