GL_RGB8 vs GL_RGBA8 & 3D Textures

I’ve found that uploading a 3D texture on a 9700 that’s larger than the available graphics memory will cause the program to hang.

One way that I thought I could potentially get around this is to “compress” my data and upload it as GL_RGB8 instead of GL_RGBA8. However, even though the memory is reduced from 128 Mb to 96 Mb, it still hangs. There should be enough video memory free to store a 96 Mb texture.

Are GL_RGB8 textures converted into GL_RGBA8 internally? Do all graphics cards do this? Is there a way to tell if they do?


In order:

1: Almost certainly.
2: Most likely.
3: No.

Hmm, that sucks. You would think that they would let the user make the tradeoff between memory size and memory alignment, which I assume is the reason for the conversion.

Oh well, thanks for the reply.

Hold it on #3!

I think there is a way to query for the internal format of the hardware.

glGetTexLevelParameteriv(GL_TEXTURE_3D, 0, GL_TEXTURE_COMPONENTS, param);

or maybe it will lie to you, but try it.

It will likely still consider it an RGB texture when you querry it. The hardware may even mask out the alpha component when you try to render with it, as it is probably garbage data. Also, the GL spec probably has certain behavior that should happen when you access the alpha component of a texture that lacks alpha data.