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 2 of 2

Thread: how to mask out colors I need?

  1. #1
    Junior Member Newbie
    Join Date
    Apr 2004
    Posts
    2

    how to mask out colors I need?

    I have an OpenGL DC with a picture drawn on it. The picture has backgroud color BgColor. I want to draw on this DC a polygon with color PolyColor, so that any pixel under this polygon which is equal to BgColor, will PolyColor. If a pixel color is equal to PolyColor, it must be inversed. The picture is a some lines and rectangles drawn on BgColor. The problem, that I get ready image, and do not draw it myself. So I can't use any buffers (stensil, accumulate, etc.). And I can't find any function, which converts any color to a color I need. Only color's components, that doesn't much for me. In short, if somebody knows how to help me or where I can ask this question or find any usefull info, please tell me.
    Thanks!

  2. #2
    Super Moderator OpenGL Lord
    Join Date
    Dec 2003
    Location
    Grenoble - France
    Posts
    5,655

    Re: how to mask out colors I need?

    Depending on the hardware and performance wanted, I see 2 solutions :

    1) basic hardware, no need for great performance :
    use glReadPixels to retrieve the framebuffer pixels into an array. Do your color conversions with the CPU. Then draw the array with glDrawPixels.

    2) hardware with fragment shader support :
    do it with a shader with the GPU.

    Hope it helps.

Posting Permissions

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