glBlendFunc

Member
Posts: 90
Joined: 2006.11
Post: #1
I have an image(a) that I want to display over other images.

The image(a) is supposed to be a rectangle with a cross. The rectangle is opaque.

Using glBlendFunc (GL_ONE, GL_ONE), however, the rectangle turns out not to be opaque. I have also tried various other glBlendfunc parameters but GL_ONE is working the best for now. I need a better one?

I get this:

[Image: picture1nl2.png]

If I don't use blending the rectangle would be opaque, however, the areas between the arms of the cross would be black.

EDIT: After several dozen trial and errors:

glBlendFunc (GL_ONE, GL_ONE_MINUS_SRC_ALPHA);

is probably right. http://jerome.jouvie.free.fr/OpenGl/Less...php#Sample helped
Quote this message in a reply
DoG
Moderator
Posts: 869
Joined: 2003.01
Post: #2
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA) is the right blending mode if you want to simulate simple transparency.
Quote this message in a reply
Member
Posts: 509
Joined: 2002.05
Post: #3
I've always found the many combinations of glBlendFunc confusing, but one one DoG listed is by far my most used combination.
Quote this message in a reply
Moderator
Posts: 522
Joined: 2002.04
Post: #4
A section in the Unity docs gives some examples of useful common blend types in the "Details" section:
http://unity3d.com/support/documentation...Blend.html

Just convert to the obvious corresponding GL constant.

Cheers,
-Jon
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  glColor4f and glBlendFunc for fading to white? dave05 3 5,217 Jun 24, 2005 05:31 PM
Last Post: Skorche