Mipmapping

gluBuild2DMipmaps(GL_TEXTURE_2D, GL_RGB,
                  width, height, GL_RGB,
                  GL_UNSIGNED_BYTE, pixels)

Use gluBuild2DMipmaps in place of glTexImage2D.
It will automatically generate all the smaller versions of the texture.


Example: mipmap.py