Semi-transparent texture

Hi again,

Suppose you want to draw a white text using a texture on a blue QUAD rectangle.

We tryed making a white text on transparent background image and using the blue color for the QUAD object but the white color was affected by the blue one.

Then we tryed making an image with the white text on a blue backgroud and drawing the QUAD with white color, the result is better but the blue color is not reflecting light exaclty as all the other (non textured) QUAD with the same RGB color.

What is the best apprach to achieve a perfect result?

Thanks in advance,

Alberto

Perhaps…
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

:smiley:

Well, you can use GIMP or Photoshop, see the different blending modes - and pick the one you like. Or code a shader to draw the text on blue background (blending disabled), but with some custom color-blending in the code.

We are usign standard blending, no changes with glBlenFunc() so exactly what you suggested and the result is what I described.

Honestly I didn’t wanted try every blend mode combination.

Thanks,

Alberto

Honestly, you should read manual before…

yooyo,

I will, if what I asked can be achieved. Do you know if it possible?

Thanks,

Alberto

From what I understand of your (poorly worded) question, you want to render the text with the quad in one pass.

You can do this with texture combiner state:
http://opengl.org/sdk/docs/man/xhtml/glTexEnv.xml

but honestly, it is much easier to do it in two passes.

First pass:
Render blue quad as usual

Second pass
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
Render white quad with alpha transparency texture.
glDisable(GL_BLEND);

Mmm, nice I will try immediately the two pass solution.

Is the glTexEnv the more fast rendering option and the two pass the more simple to implement one?

Thanks a lot sqrt[-1]!

Yes glTexEnv would probably be a little bit faster - but not worth worrying about unless you are drawing 10000’s of these things.