transparency and color with glDrawPixels

Posts: 2
Joined: 2006.10
Post: #1
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.
Quote this message in a reply
Posts: 5,143
Joined: 2002.04
Post: #2
DrawPixels is slow and inflexible. There's no reason ever to use it. Use a texture instead.
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Sprite transparency in OpenGL? Guest! 26 38,279 Feb 17, 2012 09:24 AM
Last Post: Skorche
  OpenGL ES 2.0, 2D Alpha Transparency Artifacts Macmenace 3 10,165 Mar 28, 2010 11:18 PM
Last Post: AnotherJake
  ? Find color value of 'pixel' in color buffer? Elphaba 1 5,483 Jul 22, 2009 01:23 PM
Last Post: Bachus
  libpng transparency problem wyrmmage 3 6,782 Mar 1, 2007 05:53 PM
Last Post: OneSadCookie
  Strange transparency errors... thingythekid 4 4,706 Aug 24, 2005 05:01 AM
Last Post: thingythekid