I notice something weird in my code and I thought it would not be complicated to clean up… and half of the day is gone now!
Basically, when I load a compressed texture, I start with these few calls:
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_GENERATE_MIPMAP, GL_TRUE);
and then call glCompressedTexImage2D for each mipmaps which size if bigger than a block size.
Well I got really surprised to notice this awful “lTexParameteri(GL_TEXTURE_2D, GL_GENERATE_MIPMAP, GL_TRUE)” that I try to always replace with glGenerateMipmap now days when I can.
I tried to remove that call because I already have my mipmaps I don’t see the point to generate anything and I actually wonder what it actually generate … probably no compressed data.
It didn’t work, the texture was render black!
I added glGenerateMipmap at the end, it works!
I played around with GL_TEXTURE_BASE_LEVEL and GL_TEXTURE_MAX_LEVEL. It works if I limit the number of mipmaps to the number I have loaded minus one …
Should I use something to generate mipmaps? Is it possible to load compressed texture without work around?
I Have a GeForce 8 with drivers 190.57