blending problem |
Author :
0stress
Post Date :
2006-09-21 09:25
Posts :
10
|
Hi,
I have a problem with alpha blending
I enable the blend function with glEnable(GL_BLEND)
but when i enable the glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA) the command haven't effect but if i do glBlendFunc(GL_SRC_ALPHA,GL_ONE) the alpha blending is correct ... WHY???
Thanks a lot
Matteo |
Author :
grant
Post Date :
2006-09-21 16:44
Posts :
117
|
Hi,
It depends what your scene looks like.
It is possible that your source alpha value is 0.0 which results in the 2nd parameter being equivalent to GL_ZERO.
Regards,
Grant |
Author :
0stress
Post Date :
2006-09-21 16:59
Posts :
10
|
but the alpha values isn't 0 never... |
Author :
grant
Post Date :
2006-09-22 06:47
Posts :
117
|
Hi,
Are you disabling depth testing :
glDisable(GL_DEPTH_TEST);
as this can cause problems. Please paste a small segment of your code here so we can see how your calls are structured.
Regards,
Grant |
Author :
0stress
Post Date :
2006-09-22 08:32
Posts :
10
|
I disable depth test yet but the effect si like previous.
passes = 1;
draw opaque object
passes = 2;
glDisable(GL_DEPTH_TEST);
glEnable(GL_BLEND);
draw transparency object
glEnable(GL_DEPTH_TEST);
glDisable(GL_BLEND);
in the draw method :
if(passes==1){
if(isTransparency==false){
DRAW
}
}
if(passes==2){
if(isTransparency==true){
glBlendFunc(GL_SRC_ALPHA , GL_ONE);
DRAW_OTHERS |
Author :
grant
Post Date :
2006-09-25 07:24
Posts :
117
|
Hi,
Are you setting the colors of your objects with some alpha value which is not 0.0 or 1.0 (ie. using glColor4f, etc.).
Also, make sure that your glClearColor function has 1.0 as the alpha value as sometimes this can also cause issues.
Regards,
Grant |
All Rights Reserved, © Zeus Communications, Multimedia & Development 2004-2005