#### Archived

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

# Transparency?

This topic is 6253 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Well, I''ve been reading through the OpenGL Game Programming book and I noticed that it doesn''t talk much about 2D (or 3D for that matter) transparency. It states that there are several blend functions and to use each of them to find new effects. It also states that transparency is the result of subtacting the source from the destination (or vice versa?) polygons but what exactly are they? Is the source polygon the first one drawn? It seems to me that the first one would be the source and the second the destination but an explanation would be nice... And this kind of thing happens a few places in the book really, somewhat annoying. Don''t just say, "Do this and you''ll get this result" without explaining exactly why... Well anyway, back to my question. Anyway able to explain this transparency thing a little better? - Mike

##### Share on other sites
oki, its quite simple really.
source is the incomming fragment ( ie the pixel that is about to be drawn to the framebuffer), and destination is the fragment that is allready there (ie the current value of the pixel at the location of the incomming pixel about to be drawn in the frame buffer).
The actual blend equation used by openGL is: -
Red(source)*Source(RedFactor) + Red(dest)*Dest(RedFactor)
and so on for the other channels.
The params to glBlendFunction, set what is used for the source(RedFactor) and dest(redFactor),( and obviouly the factors for the other channels). Simple example, glBlendFunc(GL_ZERO,GL_ONE) would be like this: -
Red(source)*0 + Red(dest)*1.
Also if your implementation supports it you can change the above equation by calling glBlendEquation(), this is part of the openGL 1.2 imaging subset so you may have to call it in extension styleeee.
hope thats of some use.

##### Share on other sites
i thnk its time for nehe.gamedev.net!

##### Share on other sites
check my site theres a demo that lets u play around with the blending methods + shows the math behind it

1. 1
Rutin
31
2. 2
3. 3
4. 4
5. 5

• 13
• 49
• 11
• 10
• 14
• ### Forum Statistics

• Total Topics
632965
• Total Posts
3009546
• ### Who's Online (See full list)

There are no registered users currently online

×