0

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?

ajeetdl
  • 1,254
  • 1
  • 13
  • 17
  • please provide some more details, do you generate all levels or only some of them, do you touch TEXTURE_BASE_LEVEL and TEXTURE_MAX_LEVEL values? – Vasaka Jul 02 '13 at 13:10
  • I make no such modifications, I simply use glGenerateMipMap and apply the filters. – ajeetdl Jul 02 '13 at 23:13

1 Answers1

2

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);
Vasaka
  • 1,953
  • 1
  • 19
  • 30
  • Thanks. The hint appears to make no difference in my case. – ajeetdl Jul 02 '13 at 23:12
  • I appreciate your help, unfortunately that does not help, the texture still appear blurry. Have you used glGenerateMipmap with OpenGL ES 2.0 on iOS yourself and achieved good results? – ajeetdl Jul 04 '13 at 02:58