🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

3dfx cards and RGBA textures (OpenGL)

Started by
2 comments, last by Dark Druid 23 years, 11 months ago
Ok, this has been buggin me for a while, I have a voodoo3 and when I load my textures in RGB mode (no transparency) it displays fine, but when I load it in RGBA mode (with transparency), the texture''s colors are visibly graded (like it''s using only a few colors). Bugging me further, for the people who don''t use a 3dfx card (that I tested) it shows up ok. I know it can be done as I have seen it (ie.: OpenGL games...) but I can''t seem to figure out why it doesn''t work, what am I missing? I have been able to force it by modifying the PixelFormatDescriptor, but I lose all hardware acceleration by doing so... I''m hoping someone has had the same problem and found the solution, 3dfx''s OpenGL support seems pretty "iffy" if you ask me...
Advertisement
What you''ve to set is the internal texture format (you know, the 3rd argument in glTexImage2d). Unfortunately, i don''t believe it is possible to fix your problem, and here is why:

3dfx texture''s format are always in 16 bits colors. When you ask a simple RGB format, the internal format used (to store the texture) will probably be something like R5/G5/B5 (=> 15 bits used, 1 unused). When you ask a RGBA format, the internal format used will probably be R4/G4/B4/A4 (=> 16 bits used). As you see, you loose 1 bit in the standard color components. You have 2 times less accuracy in the colors, which explains your problem.

Unfortunately there is no solution that i''m aware of. Textures are always 16 bits. If you ask more alpha bits, you''ll have less for color components. Worse, there is no way to specify exactly how many colors/alpha components you want. With my 3dfx, these are the only 3 internal formats that seem to be working:

- R5/G5/B5
- R4/G4/B4/A4
- A8

If your textures are static, maybe you can dither them ? Will be better than nothing..

Hope that helps,

Y.
I had an idea, what if I can work around these limitations by using the equivalent of 32bit graphics by only specifying one color component and one alpha value... for example, a translucent water texture, I ditch the RG components (which would not be used anyway) and share the 16bits with the BA components, 2 8bit components, which is the equivalent of a 32bit RGBA. I know the glTexImage2d function let''s you specify the number of components (1 to 4), in this case 2, then enumerate the format, instead of GL_RGB or GL_RGBA, use GL_BLUE | GL_ALPHA, and booya! 32bit graphics on my crappy voodoo3!

If that doesn''t work, I guess you can always use a color index mode with GL_COLOR_INDEX, but I don''t really want to go there...

Thanks for helping me stimulate the old brain cells... let''s just hope it works.
The first idea can work..hmm let me think. There is an internal format LUMINANCE_ALPHA, but i do not recall exactly how many bits luminance and alpha can be. Maybe 12/4 ?
If it does exist, you can store your blue component in luminance. With 12 bits, you will get a nice result. Since it''s luminance (=> gray), the only trick, i think, would be to specify the colors at each vertex, like blue for water.

I don''t think color index mode is working on Vaudoos, and anyway it''s a bit old.

Y.

This topic is closed to new replies.

Advertisement