Sign in to follow this  
RuneLancer

Blending issues...

Recommended Posts

RuneLancer    253
I'm trying to do something relatively simple, and for some reason it isn't working. Attempts to google for it revealed code that did the exact same thing, and even earlier projects based on NeHe's tutorial do the same thing and those work.. Basically, I'm implanting a debugging menu in my graphics engine with which I can tweak the current map's parameters (fog, lights, texturing...) To do this, I render bitmap fonts. So far so good, I get my menu and it works just fine. Problem is, text doesn't always blend with the background, and it gets kind of hard to make out after a while. Think "badly-designed geocities/angelfire site" bad. ;) My solution? Simple. Just stick a 50% transluscent untextured black quad behind the text. That way I won't obscure the scene, and the scene doesn't interfere with the text. Easy as pie, right? Well, no. For some reason currently unknown to me, when I enable GL_BLEND the quad vanishes entirely. Basically I glLoadIdentity() to reset the view and place my text/background quad at a static location on the screen (this is drawn after the scene.) I then enable GL_BLEND, set the color to {0.0f 0.0f 0.0f 0.5f} (I've also tried white and varies other values for the last parameters,) and then I render a single quad. Then I disable GL_BLEND and render the rest of the text. Except this makes the quad vanish no matter what I seem to do with it (the text is fine.) Any ideas what could cause this to happen? Is there some property I forgot to enable/disable? I don't want to resort to alpha blending with a texture for something as simple as this; any help would be appreciated. :) Edit: A screenshot of what it looks like. Obviously you can't see the quad behind the text or I wouldn't be posting this. :P Free Image Hosting at www.ImageShack.us

Share this post


Link to post
Share on other sites
mrbastard    1577
check your blendfunc and alpha test settings. Sounds like you've got alpha test enabled and ignoring anything less than 1.0.

Share this post


Link to post
Share on other sites
RuneLancer    253
Doesn't seem to be the case... I've tried fiddling with those and it still doesn't show up. :(

glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glAlphaFunc(GL_LESS, 0.05f);

Edit: Oh god. I fixed it. I hadn't disabled textures. XD

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this