is there a way to get the index of color from an indexed PNG?

Viewed 14

I'm trying to write a webgl shader to do a palette swap of an indexed png. sometimes the texture will be used with the rgb palette defined in the png itself, which of course requires no custom code, but other times I would like to display it with a different palette. however, it seems that simply sampling the texture returns a vec4, i.e. the rgb color from the palette, which is not what I want. is there a way to load a indexed png as an array of int values representing the color indices?

0 Answers
Related