PDA

View Full Version : Blending



JeroenHaafkes
11-20-2006, 12:18 AM
Hi

I have a problem with blending with a constant alpha. When I set the
alpha value with the glBlendColor function. it seems that this does not
do anything. My code is as follows:

GLfloat cae[4];
glGetFloatv (GL_BLEND_COLOR, cae);
Log("cae=[%f,%f,%f,%f]\n",
cae[0],cae[1],cae[2],cae[3]);

glBlendColor(0.0, 0.0, 0.0, 0.9);

glGetFloatv (GL_BLEND_COLOR, cae);
Log("after glBlendColor: cae=[%f,%f,%f,%f]\n",
cae[0],cae[1],cae[2],cae[3]);

glEnable(GL_BLEND);

glBlendFunc(GL_CONSTANT_ALPHA_EXT, GL_ONE_MINUS_CONSTANT_ALPHA_EXT);

glTranslated(the_view->left + 0.5, the_view->bottom + 0.5, 0.0);
glRasterPos2d (0.0, 0.0);

glDrawPixels(width, height, GL_BGRA, GL_UNSIGNED_BYTE, the_view->image);


Both loggings display an alpha value of 0.0 (all four values are 0.0),
so the glBlendColor has no effect. Therefore I see no picture after the
call to glDrawPixels, because glBlendFund is called with src=0 and dst=1;

I'm using the latest NVIDIA driver on a linux platform (x86).

Does anyone know why this is not working or has an idea what is going
wrong ?

Jeroen.