transparency and color with glDrawPixels
I'm drawing a grayscale pixmap to the screen using glDrawPixels(). Is there anyway to both change the color of the drawn pixels (such as tinting them red) and also prevent the black pixels from being drawn at all?
My ideas so far have been to try doing multiple passes using the pixmap first for alpha, then for luminance -- but that didn't work. And to change the colors, I have tried using glPixelTransferf to scale the RGB components -- that didn't seem to do anything at all. The best solution I've got so far is to enable glLogicOp(GL_OR) so that at least the black pixels don't overwrite the destination fragments.
But I was hoping someone here might be able to come up with a magic combination of OpenGL commands to accomplish what I want with glDrawPixels(). Would any of the imaging subset commands help me here? Not looking for the obvious texture solutions.
My ideas so far have been to try doing multiple passes using the pixmap first for alpha, then for luminance -- but that didn't work. And to change the colors, I have tried using glPixelTransferf to scale the RGB components -- that didn't seem to do anything at all. The best solution I've got so far is to enable glLogicOp(GL_OR) so that at least the black pixels don't overwrite the destination fragments.
But I was hoping someone here might be able to come up with a magic combination of OpenGL commands to accomplish what I want with glDrawPixels(). Would any of the imaging subset commands help me here? Not looking for the obvious texture solutions.
DrawPixels is slow and inflexible. There's no reason ever to use it. Use a texture instead.
Possibly Related Threads...
| Thread: | Author | Replies: | Views: | Last Post | |
| Sprite transparency in OpenGL? | Guest! | 26 | 24,435 |
Feb 17, 2012 09:24 AM Last Post: Skorche |
|
| OpenGL ES 2.0, 2D Alpha Transparency Artifacts | Macmenace | 3 | 6,222 |
Mar 28, 2010 11:18 PM Last Post: AnotherJake |
|
| ? Find color value of 'pixel' in color buffer? | Elphaba | 1 | 3,771 |
Jul 22, 2009 01:23 PM Last Post: Bachus |
|
| libpng transparency problem | wyrmmage | 3 | 4,310 |
Mar 1, 2007 05:53 PM Last Post: OneSadCookie |
|
| Strange transparency errors... | thingythekid | 4 | 4,001 |
Aug 24, 2005 05:01 AM Last Post: thingythekid |
|

