In each of my textures, I use 4 bytes for each pixel. RGBA.
Now when I load the texture using glTexImage2D with RGBA and 3 colour components, it looks fine, but i can’t use the transparency.
When i use 4 colour components, I can get transparency, but all the textures look like they have lost quality.
Anyone got an explanation?
thanks in advance
Could you explain what you mean by “lost quality”?
If the problem is color degradation, the only reason I can think of is that the driver is using different internal formats in the 2 situations. When it has to store 4-channel textures, it enables the alpha bits and losts some precision in representing other colors. This depends on how the driver has choosen to optimize texture representation, and maybe dithering.
probably what you see are banding artifacts.
i suppose that opengl systems developers choose to use less bits of precision (say 4) when
using RGBA textures, for reasons like paolom say.
the other components still use 8-bit, so colors render well only when alpha=0.
i tested RGBA textures on tnt and g200 chips, and i noticed they can be seen only when alpha!=0.
i didn’t noticed any artifact when i upload texture as GL_ALPHA, so maybe this can be a way to avoid banding…
maybe multitexturing (ie, unit1=GL_RGB, unit2=GL_ALPHA) could be a way to increase alpha precision, but i didn’t tested it yet.
Thank you all for the replies.
The loss in quality is I have 16 bpp textures, but when I use 4 colour components, it looks like the textures are 8 bpp (256 colours)
Out of curiosity what video card is this?
I have a TNT2 Ultra and I am having essentially the same problem, except I’m not exactly sure what it is, I am using 4 components but I have not tried leaving the alpha off, so I do not know the quality…
You could try to set manually a different internal format.
If you must use 16bpp textures, the choice is restricted to two options: GL_RGBA4 (4-4-4-4) or GL_RGB5_A1 (5-5-5-1). The former allows for better blending, while the latter will offer much more precision in the color primaries (RGB components).
If you can work with 32bit textures, you have the RGBA8 (8-8-8-8) format, which is probably the best in most cases: as a drawback, memory consumption is doubled.
I have a Voodoo Banshee 16mb Card. I wish now I had bought a TNT2 though, coz of problems with fog and my banshee
Thanks for the help, i’ll try em out asap