Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 6 of 6

Thread: Color Space

Hybrid View

  1. #1
    Junior Member Newbie
    Join Date
    Dec 2001
    Posts
    16

    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

  2. #2
    Member Regular Contributor
    Join Date
    Jun 2000
    Location
    Karlsruhe, Germany
    Posts
    486

    Re: Color Space

    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).]

  3. #3
    Senior Member OpenGL Guru
    Join Date
    Mar 2001
    Posts
    3,768

    Re: Color Space

    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.

  4. #4
    Junior Member Newbie
    Join Date
    Dec 2001
    Posts
    16

    Re: Color Space

    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).]

  5. #5
    Junior Member Newbie
    Join Date
    Dec 2001
    Posts
    16

    Re: Color Space

    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

  6. #6
    Member Regular Contributor
    Join Date
    Apr 2000
    Location
    Redlands, CA, USA
    Posts
    292

    Re: Color Space

    how about glBlendFunc( GL_ONE, GL_ONE ) ?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •