PDA

View Full Version : Change specific colors in textures to other specific colors (pallet swap)



Entity1037
06-14-2015, 11:56 PM
So I'm making a game using OpenGL, and I've gotten by by using multiple tutorials, however I am still pretty unfamiliar with using most of OpenGL. I have no idea how to change the color of pixels in textures, or how to really use FBOs. I need to be able to change my character's colors like how Mega Man changes his colors, but I have no idea how to do this with OpenGL, and I haven't been able to find anything helpful on this despite searching for LITERALLY WEEKS! Could someone please help me?

Oply1953
06-15-2015, 01:53 AM
Or... you could simply use a sprite sheet with all the colors you want your character to have. That's pretty much what most 2D games would have implemented.

GClements
06-15-2015, 03:26 AM
So I'm making a game using OpenGL, and I've gotten by by using multiple tutorials, however I am still pretty unfamiliar with using most of OpenGL. I have no idea how to change the color of pixels in textures, or how to really use FBOs. I need to be able to change my character's colors like how Mega Man changes his colors, but I have no idea how to do this with OpenGL
I've never played Mega Man, but given that it appears to be an NES game, I'm assuming that it uses colour-index (aka colour-mapped, paletted) textures. Apart from the EXT_paletted_texture extension (which isn't supported on modern hardware), OpenGL doesn't support these directly. However, you can implement them yourself using a fragment shader.