Wierd Alpha Blending problem

I have this image with a circular alpha channel in the middle

and when i load it in with some alpha blending it looks like this

i use the following to blend it:

  glAlphaFunc(GL_GREATER, 0);

and this is my init code

glShadeModel(GL_FLAT); // Enable Smooth Shading
glClearColor(0.0f, 0.0f, 0.0f, 0.0f); // Black Background
glClearDepth(1.0f); // Depth Buffer Setup
glDepthFunc(GL_LESS); // The Type Of Depth Testing To Do
glEnable(GL_DEPTH_TEST); // Enables Depth Testing
glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST); // Really Nice Perspective Calculations

i know that its fading out to black because of the clear colour but what is with the banding?? And can i stop it from fading to black at all? and actually use the alpha channels?

[This message has been edited by weebull (edited 03-22-2003).]

[This message has been edited by weebull (edited 03-22-2003).]

I’m not certain, but I expect it’s fading out to black because you haven’t enabled blending with glEnable(GL_BLEND).

Don’t know why the banding appears. What is the pixel depth of the display surface?


I’d say the banding is because your texture gets loaded as 16bit for some reason. Propably your display is set to 16bit colors. 16bit alpha textures look bad, because you only have four bits per color channel. Certain drivers load all textures as 16bit by default, to improve your changes to get 32bit textures, use GL_RGBA8 internal format.

The black edge is propably there, because you draw the circle on a black background with depth test enabled, and after that you draw the background, which gets behind the pixels that have already been blended with a black background. Always draw opaque objects first, and then the transparent ones, preferably with depth writes disabled and sorted back to front.


ah nice one justhanging it was because i was drawing it first n opengl was doing its wierd blending!!

though now i have to sort out the issue of drawing the hud stuff last and getting it to billboard and move with the camera