[gameprogrammer] Re: Open gl greyscale to color palette

  • From: Alan Wolfe <alan.wolfe@xxxxxxxxx>
  • To: gameprogrammer@xxxxxxxxxxxxx
  • Date: Fri, 2 Oct 2009 20:22:44 -0700

Well, apart from looping through your image data and manually changing the
R,G,B i'm not sure how you'd do go about doing that.

Is it something you need to redo every frame?  If so, does every color need
to be updated every frame?

I'm curious what you are trying to do.  My guess would be you want to do the
old "pallete color rotation as animation" trick, but totally a stab in the
dark.

On Fri, Oct 2, 2009 at 8:18 PM, Kevin Jenkins <gameprogrammer@xxxxxxxxxx>wrote:

> 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: