PDA

View Full Version : documentation for GL_GENERATE_MIPMAPS with borders



Clive
10-30-2008, 09:25 AM
The documentation on the use of GL_GENERATE_MIPMAPS with borders is somewhat thin, and in some places contradictory. Supposedly the following sets-up automatic mipmap generation:

glTexParameteri(GL_TEXTURE_2D, GL_GENERATE_MIPMAPS, GL_TRUE);

and so that a call to:

glTexImage(0-th level, ..., border, ...)

should generate all the mipmaps.
This seems to work just fine if border = 0 :p but only generates textures for the 0-th level if border = 1 :sorrow:. No OpenGL error is omitted. I have this is running on an NVIDIA 8800 with all the latest drivers etc. I gather that GL_GENERATE_MIPMAPS was introduced in OpenGL 1.4 so it should be pretty mature by now, however, the documentation is weak. The infamous "Red Book" hardly mentions it (the book is a peeve of mine). My suspicion is that GL_GENERATE_MIPMAPS is tacitly assumed that this for non-borderd textures. Can anyone confirm this?

BTW:
I have abandoned Build2DMipmaps() for two reasons: first is does not support borders and secondly it is significantly slower than a call to glTexImage() using GL_GENERATE_MIPMAPS. The only purpose served by Build2DMipmaps() seems to be that it tackles non-power-of-two textures.