Color Space

Hi ,
Trying to draw 3 polygons (Red , Green , Blue) overlapping each other to get the RGB color space using blending but cant get it to work. Any ideas. I am using
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_BLEND);

50% Alpha values for each polygon color.

Thanks

DP

Do you render back-to-front, front-to-back or unsorted? you must (back to front) sort the polys to get the correct results.

And if you are rendering 3 polys you also must set the alpha to 0.33 and not to 0.5.

-Lev

[This message has been edited by Lev (edited 12-27-2001).]

There are far easier ways to compute the colorspace than using alpha blending. Computing it directly, for example, is much simpler, and it doesn’t rely on rendering. You can simply create a bitmap and fill it with the appropriate colors.

Hi,
Thanks for the replies…
Yes,I was drawing from back to front and still I cannot get the colorspace to work even with 0.33 .

Here is the figure that i want to achieve

…<–Green Poly->
<–Red Poly–>

|…|…|…|
|…|…|…|
|…---------------…|
|…|…|…|…|…|
|…|…|…W…|…|…|
------|-------------|----
…|…|…
…|…|…
…---------------…
…<–Blue Poly–>…

consider dots(.) as white spaces and horizontal and vertical lines as polygon boundary lines.

I need the zone denoted by ‘W’ in figure to be white when I do blending.

What value of alpha should I use in glclearcolor. Seems it does not matter. I am using :
glClearColor(1.0,1.0,1.0,1.0);

When I set white background with alpha value 0 or 1 , and blending is turned ON, why does Red not Red anymore, it brightens. I would think that blending would work only when a polygon is being drawn above some other polygon. Is there a way to control this behaviour. Am I confusing this with shineness ?

Thanks

DPS

[This message has been edited by dpsv (edited 12-28-2001).]

[This message has been edited by dpsv (edited 12-28-2001).]

Hi ,
Just figured out that using blending I can never get a white color , which means I cannot create a color space. Its because the value of RGB colors will keep on decreasing and will make a black color eventually.

Thanks

DPS

how about glBlendFunc( GL_ONE, GL_ONE ) ?