Archived

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

Alpha Blending

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

Hello I have been trying for quite a while now to get alpha blending working properly. I am using SDL 1.23, SDL Image 1.20, and OpenGL in Linux. I use SDL Image to load the image (png, bmp, tga I have tried I think). I bhave a 3D application, and am trying to create a cursor. I can get the cursor to draw, but not with proper blending. For example, glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); which was recommended in NeHe''s tutorials caused nothing to blend. I tried various combinations for glBlendFunc (not knowing fully what they do), and received mixed results - the best being the supposedly transparent area being totally transparent, but the colored areas still being semi-transparent. Help using SDL Image to load a png, and so that only the transparent bit is transparent, and the rest is solid would be much appreciated. The problem may be with the alpha channel not being properly setup, so help doing this with the GIMP would also be useful. (when I load my png image in the gimp, it shows the transparent area as the grey grids you normally get). Thanks for any help Tyreth

Share this post


Link to post
Share on other sites
glEnable(GL_ALPHA_TEST); didn''t help. Was I supposed to do some other settings with it too, or just enable it?

Share this post


Link to post
Share on other sites
I don''t know - that''s half the problem. In the gimp when I use the color picker on a colored area of my png, it says Alpha is 255, and the transpared (grey gridded bit) is an Alpha 0. I have also tried with images that seem to work for other applications, but I still can''t see what I am doing different.

Share this post


Link to post
Share on other sites
What kind of texture function do you use?
GL_REPLACE ?
If not - vertex alpha may affect your texture.

Share this post


Link to post
Share on other sites
Ok, say I got a .tga image with alpha channel which is( the image) is red circle on black.
How do I draw that red circle without black on a quad?

Share this post


Link to post
Share on other sites
gimp saves tga''s differently than say photoshop.
make a 256x256 sized image and save it as a uncompressed tga file. now see how large the file is if its 256kb then theres an alpha channel. if its 192kb then there is no alpha channel.

Share this post


Link to post
Share on other sites
I think that your question is being answered in the NeHe forum. (right click on the image and layers->add alpha channel)

Share this post


Link to post
Share on other sites