texture with transparent color?

hi i have a texture quad, the texture has a text (says “HELLO”) and its background is all black (0,0,0) … I want the black become transparent how can i do this? so if i put a cube and a quad textured with the text i can see both text and cube.

can this be done easly??

I think you have 3 choices (you’ll need an RGBA texture)

  1. pre-process your texture, changing all bytes with a color of 0,0,0,x to 0,0,0,0.
  2. Use an alpha channel.
  3. write a fragment shader that does the texturing and set all fragment’s alpha to 0 that sample 0,0,0 from the texture.

my image exporter exports bitmap 24bits only
i dont think this format can handle alpha data??

so theres no other way? blending etc?

You don’t need an RGBA (32-bit) texture for method 3.

You sample the texture, if the color rgb = 0,0,0 don’t apply the texture (i.e. the fragment color stays the color of the material).

You’ll need a 32-bit (alpha enabled) Pixel Format Descriptor though - but I can’t imagine you’re not using one those.