gluBuild2DMipmaps -> question on format


I was unsure whether this should go in the beginning or advanced question forum…

I’m trying to optimize some code that uses a lot of textures at high resolution ( > 512x512).

I have read through the blue and red books 1.1 and saw that there isn’t much flexibility in setting the internal format when using gluBuild2DMipmaps.

Is there anyway to set the internal format similarly to the glTexImage2D function. I want to set the internal format to GL_RGB and GL_RGB5_A1 to save space.

I know one solution is to biuld my on mipmap creation function using the gluScaleImage and glTexImage2D myself, but figured the gluBuild2DMipMaps might be able to do the same thing.

Also should I expect much of a savings using this. Are these internal formats (RGB5 and RGB5_A1 ) typically supported? Do the affect performance negatively in other ways?

Thanks for your help

My question is this, can I use formats specified as valid for glTexImage2D internal list or am I limited to the smaller subset listed in the format list

You can use the same formats with gluBuild2DMipmaps … like this:
gluBuild2DMipmaps(GL_TEXTURE_2D, GL_RGB5_A1, Height, Width, GL_RGBA, GL_UNSIGNED_BYTE, &TextureData);
These format is the most commonly supported, more supported than 32 bit textures or palettized textures.
Using 16 bit formats halves the memory use and halves the texture memory bandwitdh needs. So performace should rather increase than decrese.

Thanks for the info.

It was kind of odd, I tried the formats assuming they were the same as glTexImage2D, and they seemed to work, then read the documentation and it said only valid params where 1,2,3,4. Ironic that reading the documentation caused more confusion.

I’ll play around with other formats. At least now I know it is legal.

Thanks again.