Reputation: 2562
How do I achieve this effect in Moai? I want to change every pixel of a image to white, but keep the transparency. And I don't want to generate extra images.
Upvotes: 1
Views: 102
Reputation: 426
Create a custom shader! You can use the default deck texture shader as an example. It's in the source somewhere (moai-sim/MOAIShader.. something).
Then instead of settings glFragColor to sampler you set it to for example (white) glFragColor = vec4(1, 1, 1, 1) * sampler.a;
So that you multiply the color white by the textures alpha value.
Look at samples/graphics/ for some shader code. It's not dead simple but it's very flexible once you get it up and running.
Upvotes: 0