Category: 

What Are the Best Tips for OpenGL® Blending?

Article Details
  • Written By: Alex Newth
  • Edited By: Angela B.
  • Last Modified Date: 06 September 2016
  • Copyright Protected:
    2003-2016
    Conjecture Corporation
  • Print this Article
Free Widgets for your Site/Blog
Roughly one-fifth of the world's stock of gold - worth over $200 billion USD - is stored under the streets of London.  more...

September 30 ,  1949 :  The Berlin Air Lift ended.  more...

The Open Graphics Library® (OpenGL®) blending tool is important for making different colors, introducing transparency and making well-rendered images, but it can be difficult to use at times. Before OpenGL® blending can be used, some programming has to be applied to enable the feature. If the user wants to make an object transparent, then he does this by changing the alpha amount of the object. Getting the order of colors right, especially in overlapped areas, is important to ensure that the user properly blends the different colors. Textures can be blended with this tool, but only the texture itself and not primitives.

Many advanced OpenGL® users understand that, to use OpenGL® blending, the tool must first be enabled, but some new users may not know this. To activate blending, users have to type in “glEnable (GL_BLEND);” without the quotation marks. Under this line the user can type in the blend effect he wishes to achieve. Blend also should be disabled when it is not being used, or the tool may take instructions meant for another tool and incorrectly apply them.

Ad

Transparency is important for many advanced designs, and this is achieved by using OpenGL® blending. To do this, the user must alter alpha levels of the object; this mostly is done with primitives, but it also can be applied to other objects. Aside from changing the alpha levels, this also forces the users to change how the primitives are rendered after the blending. Solid primitives must be rendered first and then those that are semi-transparent, or the graphics will not show the transparency effect.

If the OpenGL® blending tool is used at the wrong time, then this may cause the two blended objects to improperly blend or there may be no blending at all. To use the blend properly, the user should first make an object with a certain color. He then should activate blending and put down a second object, or the object he wants blended.

Textures often are used with OpenGL®, because they can make primitives look better and, while textures can be used with OpenGL® blending, only the texture itself can be blended. This means the user cannot blend a primitive that is being used in conjunction with a texture. The transparency of the texture commonly is changed to help it blend with other objects. If the user wants the texture’s primitive to be blended, then he has to change the texture’s environment.

Ad

You might also Like

Recommended

Discuss this Article

Post your comments

exception 'Exception' with message 'error writing captcha: Duplicate entry '2147483647' for key 'PRIMARY'' in /ssd/www/wisegeek/public_html/_core/classes/public/Captcha.php:44
Stack trace:
#0 /ssd/www/wisegeek/public_html/_core/controls/public/ControlDiscussionPostBox.php(324): Captcha->createCaptcha()
#1 /ssd/www/wisegeek/public_html/framework/classes/Control.php(104): ControlDiscussionPostBox->preRender(false)
#2 /ssd/www/wisegeek/public_html/framework/classes/Control.php(149): Control->render()
#3 /ssd/www/wisegeek/public_html/tpl/default-nocustom-lu/pages/public/article/article.htm(526): Control->__toString()
#4 /ssd/www/wisegeek/public_html/framework/classes/Control.php(300): require('/ssd/www/wisege...')
#5 /ssd/www/wisegeek/public_html/framework/classes/Control.php(309): Control->requireTpl('pages/public/ar...', Object(PageArticleCom), true)
#6 /ssd/www/wisegeek/public_html/framework/classes/Control.php(131): Control->renderTpl('pages/public/ar...', Object(PageArticleCom))
#7 /ssd/www/wisegeek/public_html/framework/classes/FormDataControl.php(87): Control->renderTemplate()
#8 /ssd/www/wisegeek/public_html/framework/classes/Control.php(109): FormDataControl->renderTemplate()
#9 /ssd/www/wisegeek/public_html/framework/classes/ScriptPage.php(50): Control->render(false)
#10 /ssd/www/wisegeek/public_html/framework/classes/Control.php(149): ScriptPage->render()
#11 /ssd/www/wisegeek/public_html/framework/classes/Page.php(97): Control->__toString()
#12 /ssd/www/wisegeek/public_html/_core/classes/public/PublicFrontController.php(443): Page->processRequest()
#13 /ssd/www/wisegeek/public_html/_core/classes/public/PublicFrontController.php(7): PublicFrontController->renderPage()
#14 /ssd/www/wisegeek/public_html/index.php(11): PublicFrontController::run()
#15 {main}