View Full Version : alpha values in textures
08-10-2001, 05:09 AM
Whats the deal with alpha values in textures? It seems I can't get OpenGL to even recognize that I uploaded the image in RGBA. I've checked, and the alpha values are there, and vary between 0 and 255. But when I try to do blending, it doesn't seem to care about them.
I've tried difference combinations of glBlendFunc with GL_SRC_ALPHA and stuff, but it never makes the texture transparent where it should be. It's either solid, or all somewhat transparent.
Any clue what I'm doing wrong?
08-10-2001, 05:43 AM
Did you enable GL_BLEND at all? Maybe you're doing the alpha test.
08-10-2001, 05:59 AM
Have you checked that you pass GL_RGBA (or at least something with alpha in it) to glTexImage2D() as the format parameter? If not, you should get a distorted texture, because the first alpha is interpreted as red, the second as green and so on.
Well, the internalFormat parameter also has to be GL_RGBA because otherwise, there is no alpha stored in the texture and blending is done on the whole texture. When you pass GL_RGBA, blending is done for each pixel as specified in the data you pass.
Hope this will help you.
08-10-2001, 06:39 AM
You were right! My internal format was wrong. I was using GL_RGB, I changed it to GL_RGBA, and now it works great. http://www.opengl.org/discussion_boards/ubb/smile.gif
Thanks for all the help guys!
Powered by vBulletin® Version 4.2.0 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.