[gameprogrammer] Re: Open gl greyscale to color palette

  • From: Kevin Jenkins <gameprogrammer@xxxxxxxxxx>
  • To: gameprogrammer@xxxxxxxxxxxxx
  • Date: Fri, 02 Oct 2009 20:18:20 -0700

Yes, I know a shader can do it. I was just wondering if there was a way to do it without a shader. I'm already using OpenGL, and this is entirely in memory.



Alan Wolfe wrote:
are you going to save it again to memory or just display it?

im not much of a graphics programmer but how about a pixel shader that took both your source texture and a 1x256 texture.

Since all the colors are the same you could use the Red component of your source image as a texture index into your 1x256 color (basically the 1x256 would act as your color lookup table).

Render this to a texture, and then bam you have your texture to re-use. Or, if the cost of doing this in real time isn't too bad, you could just have your shader do this translation each frame.

What you think?

---------------------
To unsubscribe go to http://gameprogrammer.com/mailinglist.html


Other related posts: