Jump to content
  • Advertisement


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



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

If you intended to correct an error in the post then please contact us.

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 this post

Link to post
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 this post

Link to post
Share on other sites
Guest Anonymous Poster
i thnk its time for nehe.gamedev.net!

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!