Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

+AA_970+

OpenGL Poor texture quality in OpenGL w/ alpha channel

This topic is 6093 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

When I load a 32 bit TGA file in OpenGL (with an alpha channel), there is a big loss in the quality of the texture, if I don't read the alpha channel data the texture looks fine. Here's the line that generates the texture: glTexImage2D(GL_TEXTURE_2D, 0, 4, m_dwWidth, m_dwHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE, m_pRGBAData); when the third parameter (the 4, for 4 color components) is set to 3 the image appears fine, but when I set it to 4 to read the alpha channel data the image quality is lost. The image data is contained within an array of DWORDs(m_pRGBAData) which holds all four color components. To place the color data in the DWORD I do the following bit shifts: m_pRGBAData = (r)+(g<<8L)+(b<<16L) + (a<<24L); is this correct? BTW, I have a voodoo 3 2000 which does not really support 32 bit rendering, does this affect the image quality if I blend textures with an alpha channel? [i]Digital Radiation Edited by - +AA_970+ on November 10, 2001 5:24:25 PM

Share this post


Link to post
Share on other sites
Advertisement
quote:
Original post by +AA_970+
BTW, I have a voodoo 3 2000 which does not really support 32 bit rendering, does this affect the image quality if I blend textures with an alpha channel?


Yes, that will have a huge effect on the number of colors on screen, and 16bits can only hold 65536 colors at once (which equals degradation in quality).

[Resist Windows XP''s Invasive Production Activation Technology!]

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
The previous answer is incorrect. The problem is the additional memory used by 4 component textures vs 3 and the defaults the hardware gives you for the internal format of a 4 component texture. The additional alpha information is causing the driver to restrict the bits available for RGB components. Instead of simply requesting 4 components as the internal format look at the options available to give more precision for color at the expense of alpha, for example try GL_RGB5_A1, you may also be able to improve things by avoiding the default you are given when requesting 4 components if you are more explicit about the bits you want, for example GL_RGBA8 may be slower but produce higher quality results.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!