A palette is just an array of colors, and image data is just indices in that array.
So, if you want to convert an image to an RGB image, select a new buffer large enough for your image in this format, and fill it by taking the pointer for a pixel from the original image, index the palette with this value, and save the RGB value that you get into the target image.
You can find a GL fragrance that supports the texture palette and can load them directly, but hardware support is less common these days, and all the chances are all you do is unload the driver, convert your texture to 24-bit .
For example, OpenGL ES supports some types of palette texture using the glCompressedTexImage2D() function, but it is possible that this will simply entail a load on the implementation to convert these textures into something that the hardware can handle.
If you have no problems with storage, I would prefer offline conversion (i.e. first save your images as 24-bit), but this is not technically difficult in any case.
Jasond
source share