OpenGL,Ortho,2D game:
Ok i have these units in my 2d game i want to display using various player colors.However the unit image is just 1 image.The pixels where player color should appear are known/marked out by a specific color.The unit image is displayed as a textured quad. I want to use only the unit image & say some mask to display any player color in the unit image.
So i thought the mask could be white only where player color should be present(black otherwise) & of same dimension as the unit image.
Now if i multiply a texture of dimensions=unit image but color=player color with mask, i will get a black image with the player color present in the exact positions i want them in the unit image. Now how to superimpose this image on the unit image to get the player colors there as well?.
Anyone has a better idea on how to do this whole thing? i want masks of 1 bit depth only.How to store such masks in video memory so they occupy 1 bit depth only...textures have to be 8bpp at least i think
Masking to show player color....problem.
Started by madmax, Dec 28 2006 08:50 AM
2 replies to this topic
#1
Posted 28 December 2006 - 08:50 AM
#2
Posted 28 December 2006 - 12:25 PM
You have the right idea. Forget about bits and just make it work.
#3
Posted 28 December 2006 - 07:59 PM
Just ensure that the unit image has black pixels in all the places where you want the player color to appear, and superimpose the (mask * color) using additive blending.
In fact, you could expand this, letting the mask be full grayscale rather than just black and white, which would let you make different lighter/darker shades of the player color. That could improve the appearance of things.
In fact, you could expand this, letting the mask be full grayscale rather than just black and white, which would let you make different lighter/darker shades of the player color. That could improve the appearance of things.
reedbeta.com - developer blog, OpenGL demos, and other projects
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users












