[gameprogrammer] Re: Open gl greyscale to color palette

  • From: Bob Pendleton <bob@xxxxxxxxxxxxx>
  • To: gameprogrammer@xxxxxxxxxxxxx
  • Date: Fri, 2 Oct 2009 17:00:19 -0500

You don't need OpenGL for that. You might want to use SDL but I would
just use the appropriate library for the type of the image and read it
into memory, read in the palette, and then just read through the image
one pixel at a time doing the replacement. Finally, write it back out
a file.

Bob Pendleton

On Fri, Oct 2, 2009 at 3:50 PM, Kevin Jenkins <gameprogrammer@xxxxxxxxxx> wrote:
> I'm trying to add color to an image that I have in memory. The image in
> memory is ARGB, where each component has the same value. I'd like to use the
> color value of any of the components as a lookup into a color table 256
> entries long. The existing color would be replaced by the lookup.
>
> Bob Pendleton wrote:
>>
>> You need to give more context to the question. Are you just trying to
>> add color to an image and store it in a file or are you trying to
>> display it on the screen and change its color by changing palette
>> entries? If you want to use it as a texture map you can use
>> GL_EXT_paletted_texture that would let you manipulate the palette and
>> then paint with the texture into an RGB screeen. Or, if you set the
>> screen depth to 8 bits you'll be stuck with an 8 bit paletted display
>> and you can't use anything else.
>>
>> Bob Pendleton
>>
>> On Fri, Oct 2, 2009 at 1:00 PM, Kevin Jenkins <gameprogrammer@xxxxxxxxxx>
>> wrote:
>>
>>>
>>> I have a greyscale texture that I want to colorize based on a palette,
>>> where
>>> I define each of the 256 greyscale values to a color. How would I do this
>>> in
>>> OpenGL?
>>>
>>> ---------------------
>>> To unsubscribe go to http://gameprogrammer.com/mailinglist.html
>>>
>>>
>>>
>>>
>>
>>
>>
>>
>
> ---------------------
> To unsubscribe go to http://gameprogrammer.com/mailinglist.html
>
>
>



-- 
+-----------------------------------------------------------
+ Bob Pendleton: writer and programmer
+ email: Bob@xxxxxxxxxxxxx
+ web: www.TheGrumpyProgrammer.com

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


Other related posts: