nV News Forums

 
 

nV News Forums (http://www.nvnews.net/vbulletin/index.php)
-   NVIDIA Linux (http://www.nvnews.net/vbulletin/forumdisplay.php?f=14)
-   -   Blend problem (http://www.nvnews.net/vbulletin/showthread.php?t=80878)

JeroenH 11-21-06 09:50 AM

Blend problem
 
Hi,

I use glBlendColor (0,0,0,1) to set the alpha value to 1. Then i do a glBlendFunc (GL_CONSTANT_ALPHA, GL_ONE_MINUS_CONSTANT_ALPHA).

However the glBlendColor does not really set the alpha value. When i read it out after the call to glBlendColor, it is still 0. Therefore I see no image on the screen when I do a glDrawPixels(..) (because the src var of glBlendFunc = 0 and the dst var = 1, so the image to draw is complete transparent).

Does anyone know this problem, or has a solution for it ?

Grtz,
Jeroen.

AaronP 11-21-06 12:19 PM

Re: Blend problem
 
glBlendColor doesn't set the output alpha of fragments, it just controls the coefficients in the blend equation. You'll need to control the output alpha some other way, e.g. with glColor4f. Alternatively, you can disable blending or use glBlendFunc(GL_CONSTANT_ALPHA, GL_ONE_MINUS_CONSTANT_ALPHA) before performing the glDrawPixels.

JeroenH 11-23-06 06:31 AM

Re: Blend problem
 
OK, I named it wrong (is my unexperience with opengl-stuff), but I use the glBlendColor for Blending purposes. And I already use the glBlendFunc this way. I cannot disable blending, because then my application does not work correct anymore.
Here is a part of the code that I am using:

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, GL_ONE_MINUS_CONSTANT_ALPHA);

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;

This application works fine under Solaris, but on Linux it doesn't work anymore

Grtz.


All times are GMT -5. The time now is 10:08 PM.

Powered by vBulletin® Version 3.7.1
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Copyright 1998 - 2014, nV News.