32 BPP textures

Hello!

There is a problem that I can’t figure out. I have a properly loaded 32bpp bitmap and to create a mipmap texture that can take advantage of alpha component I should use a following line :

gluBuild2DMipmaps(GL_TEXTURE_2D, 4, width, height, GL_RGBA, GL_UNSIGNED_BYTE, bitmap);

Right? OK, but when I draw the texture it appears to lose its color depth (something like 16bpp). Suprisingly, when I specify that I use 3 components the texture colors remain valid but … of course blending does not work. Something like this :

gluBuild2DMipmaps(GL_TEXTURE_2D, 3, width, height, GL_RGBA, GL_UNSIGNED_BYTE, bitmap);

What can be the problem ?? I’d be thankful for any help!

Thanks :slight_smile:

When you specify 4 as the internal format you may be getting RGBA4444 but with 3 for internal format may get more color precision with RGB565. Instead of specifying 4 as the internal format you could try to be more explicit about texture format precision with some of the other internal format tokens. Try specifying GL_RGBA8 as the internal format token and it should give you a full 32 bits of precision if that is supported by your card. It may reduce your pixel fill performance and will use more texture memory as a result, there are other tokens that may be sufficient for you but still use less texture memory and fill faster, for example GL_RGB5_A1, but that will depend on your specific requirements.

Thanks! :slight_smile:

One more question if you don’t mind … How do you think - is it better to use GL_RGBA8 textures or to simply use texture & transparency mask? Which one is more efficient ?