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 08:50 AM

Blend problem

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 ?


AaronP 11-21-06 11:19 AM

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 05: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);

glBlendColor(0.0, 0.0, 0.0, 0.9);

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



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


All times are GMT -5. The time now is 01:43 AM.

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