View Full Version : Alpha blending problem
10-21-2006, 03:12 PM
Hello, I've got a small (I think so) problem - I enable blending in my program
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);Then I render some stuff, two quads, one of them is related to mouse movement. They have the same z-axis orientation. The upper quad's (in depth buffer) alpha channel is set to 0.1f. When the lower quad is moved under the other one, I simply can't see it, the blending doesn't work. GL_BLEND is enabled for sure. I don't know what to do. The same situation is with alpha channels in sprites - they ain't working.
10-22-2006, 01:03 AM
Do not forget you still have depth test enabled :)
Very similar question solved here :
Post here again if you need more help.
10-22-2006, 03:57 AM
I disabled the depth test, but it didn't make it. I think that I have two problems related - the first one is described before, and other one is that it doesn't matter if I do like this:
glEnd();or like this:
glEnd();becouse quad 2 is always on top ;/ When I enable depth test, the quad which is lower is the one that is rendered later - and it's wrong, I want the first one to be rendered lower.
I know that I must have forgotten about something, but I can't find out what this something is ;)
10-22-2006, 04:58 AM
Ok, I solved it. The reason for wrong hierarchy was
depth func set to GL_LESS not to GL_LEQUAL - in 2D games i suppose GL_LESS is useless (maybe I'm wrong ;p)
I also solved the problem with transparency, but I really don't know how Oo, I tried many different things and it started to work, when I changed them in the backward order it still worked, so I don't know what the problem was.
Ok thank you for help ;) Greets
10-22-2006, 09:30 AM
Depth testing is disabled by default. 2D games generally don't need a depth buffer at all.
Powered by vBulletin® Version 4.2.2 Copyright © 2015 vBulletin Solutions, Inc. All rights reserved.