I'm trying to get a grip on mipmaps with OpenGL. I believe I understand the concept, but when trying to have OpenGL generate them I wonder how it determines how many mipmaps to generate?
Here's what I'm running with right now to initialize a 2d texture:
glGenTextures(1, &mTexture); glBindTexture(GL_TEXTURE_2D, mTexture); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA , textureWidth, textureHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE, &textureData); glGenerateMipmap(GL_TEXTURE_2D); glBindTexture(GL_TEXTURE_2D, 0);
Nowhere do I specify how many mipmap levels to generate. How many mipmaps are generated in this case? Where do you specify this number?
I've also seen another technique from http://www.opengl.org/wiki/Common_Mistakes where you use
glTexStorage2D to specify all the mipmaps levels instead - but how many levels can you specify and what is a reasonable number for quality?