I am working on a 2D game & using openGL with ortho view . I have these sprites which i display as textured quads. However some of these images i need to examine pixel by pixel looking for a specific color.Then instead of this color i put the appropriate 'Player Color' of the unit i am putting on screen. Imagine i have colors numbered from 0 to 255.
Then i have this special color 255 which when found in a pixel always results in the appropriate player color(say red/green/yellow for 3 players...which might be say the color 24/145/234 respec) being put in the frame buffer instead of the original pixel color. So basically i cant bind the texture right away. I need to EXAMINE EACH PIXELS & PUT THEM ON THE QUAD PIXEL BY PIXEL replacing the pixels color in the image with player color whereever a 255(indication of player color) is found.
But is this possible. What is the most fastest &most efficient way of doing this ? Could i simply write to a texture or something which i heard openGL can do. One thing is certain i need to access the pixels in a for-loop & write them out again...how hard will my frame rate be hit? i heard glDrawPixels() is slow...i need a fast method or maybe some sort of mask whatever