• Advertisement
Sign in to follow this  

glTexImage2D, luminance alpha and glowing circles

This topic is 3032 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

Can anyone tell me if there is a reason to use RGBA internal format when loading a LUMINANCE_ALPHA texture, for example: glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, Width, Height, 0, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, pData); Some examples e.g. NeHe#43, do this rather than both formats being GL_LUMINANCE_ALPHA as I would expect. What effect does this have if any? My texture is alpha enabled so it can have transparent bits, but otherwise monochromic, so I figure LUMINANCE_ALPHA is just what I need. Then when rendered I blend it glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA) for transparency and colour it with glColor. Does this sound the right way to go? I started off with RGB, unnecessary for my grey scale image, using black for transparent with glBlendFunc(GL_SRC_ALPHA,GL_ONE), however I soon discovered that the white of my texture didn't render in the colours I chose when against a non-black background, that blended as well. The idea is to get a small glowing circles in various colours from a single "glow" texture. Am I on the right track at last?

Share this post


Link to post
Share on other sites
Advertisement
If you know the image is supposed to be luminance with alpha, then there's no reason to request a full RGBA internal format. If, however, you expect to dynamically update the image with new data which may not be monochromatic, then a full RGBA internal format allows you to load new data which is not monochromatic, because you requested separate channels.

Even if you request a luminance internal format, the driver may expand the format to RGBA anyway. It will, on the other hand, behave as a monochromatic image and any attempt to load color data into it will behave as if the destination is monochromatic.

Describe intent, so if the intent is to have a monochromatic image, then describe that.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement