Archived

This topic is now archived and is closed to further replies.

trager

glBlendFunc(GL_SRC_ALPHA,GL_ONE);

Recommended Posts

trager    122
how come when I use glBlendFunc(GL_SRC_ALPHA,GL_ONE); the colour of the object comes through the texture? Is there a way around this?

Share this post


Link to post
Share on other sites
Tree Penguin    262
What do you mean by the color of the object, like the color you set with glColor4x(....)?, texels are always drawn as color
(tr*or+tg*og+tb*ob+ta*oa), where tx stands for texture x and o for object.

[edited by - Tree Penguin on January 17, 2004 7:35:27 AM]

Share this post


Link to post
Share on other sites
trager    122
yup,

so if you use color4f(1,1,1,1) the background would be white and it seems to make the texture really bright for some reason.

If you set it to red the texture takes on a red hue most annoying.

Share this post


Link to post
Share on other sites
trager    122
texels are always drawn as color
(tr*or+tg*og+tb*ob+ta*oa), where tx stands for texture x and o for object.


means close to nothing to me

Share this post


Link to post
Share on other sites
trager    122
got what you mean by (tr*or+tg*og+tb*ob+ta*oa) doesn''t seem to apply in the case of semi transparent objects on top of each other.

Think sprites on a background.

Share this post


Link to post
Share on other sites
trager    122
No luck with that james. It disabled blending and quite possibly made the original problem worse.

I think i need to describe what I''m trying to do



I have a 2d game with a simple menu.
The menu text is made from bitmaps.
The bitmaps have a few nearly black pixels around the edges.
I want to drop these and glBlendFunc(GL_SRC_ALPHA,GL_ONE); does that
I also want to be able to fade the text slighlty when it isnt selected.


I can get all of this to happen but when the menu items are drawn over the background they seem to get very bright.

When there is no background it all works perfectly.
Any ideas on how to solve this?


Share this post


Link to post
Share on other sites
jamessharpe    497
Ooops, what was I thinking!

Perhaps what you should be using is alpha testing i.e. reject the pixels where alpha is above/below some threshold value. This then leaves you with the blend function to control how much the colour gets blended with the existing scene, to allow you to control the ''intensity'' of the output

Share this post


Link to post
Share on other sites