GLAPI/glBlendEquation: Difference between revisions

From OpenGL Wiki
Jump to navigation Jump to search
4.0 API.
 
Redirect to the separate page.
 
(11 intermediate revisions by 3 users not shown)
Line 1: Line 1:
{{infobox feature
#REDIRECT [[GLAPI/glBlendEquationSeparate]]
| name = glBlendEquation
| core = 1.0
}}


'''glBlendEquation:''' specify the equation used for both the RGB blend equation and the Alpha blend equation
[[Category:Core API Ref Post Fragment Shader Operations|BlendEquation]]
 
[[Category:Core API Reference|BlendEquation]]
== Function Definition ==
 
  void '''glBlendEquation'''(GLenum ''mode'');
  void '''glBlendEquationi'''(GLuint ''buf'', GLenum ''mode'');
 
; buf
: for '''glBlendEquationi''', specifies the index of the draw buffer for which to set the blend equation.
; mode
: specifies how source and destination colors are combined. It must be {{code|GL_FUNC_ADD}}, {{code|GL_FUNC_SUBTRACT}}, {{code|GL_FUNC_REVERSE_SUBTRACT}}, {{code|GL_MIN}}, {{code|GL_MAX}}.
 
== Description ==
 
The blend equations determine how a new pixel (the ''source'' color) is combined with a pixel already in the framebuffer (the ''destination'' color). This function sets both the RGB blend equation and the alpha blend equation to a single equation. '''glBlendEquationi''' specifies the blend equation for a single draw buffer whereas '''glBlendEquation''' sets the blend equation for all draw buffers.
 
These equations use the source and destination blend factors specified by either [[GLAPI/glBlendFunc|glBlendFunc]] or [[GLAPI/glBlendFuncSeparate|glBlendFuncSeparate]]. See [[GLAPI/glBlendFunc|glBlendFunc]] or [[GLAPI/glBlendFuncSeparate|glBlendFuncSeparate]] for a description of the various blend factors.
 
In the equations that follow, source and destination color components are referred to as <!--Missing Equation--> and <!--Missing Equation-->, respectively. The result color is referred to as <!--Missing Equation-->. The source and destination blend factors are denoted <!--Missing Equation--> and <!--Missing Equation-->, respectively. For these equations all color components are understood to have values in the range <!--Missing Equation-->.
 
{|
|+
! '''Mode'''
! '''RGB Components'''
! '''Alpha Component'''
|+
| {{code|GL_FUNC_ADD}}
| <!--Missing Equation--><!--Missing Equation--><!--Missing Equation-->
| <!--Missing Equation-->
|+
| {{code|GL_FUNC_SUBTRACT}}
| <!--Missing Equation--><!--Missing Equation--><!--Missing Equation-->
| <!--Missing Equation-->
|+
| {{code|GL_FUNC_REVERSE_SUBTRACT}}
| <!--Missing Equation--><!--Missing Equation--><!--Missing Equation-->
| <!--Missing Equation-->
|+
| {{code|GL_MIN}}
| <!--Missing Equation--><!--Missing Equation--><!--Missing Equation-->
| <!--Missing Equation-->
|+
| {{code|GL_MAX}}
| <!--Missing Equation--><!--Missing Equation--><!--Missing Equation-->
| <!--Missing Equation-->
|}
 
 
 
The results of these equations are clamped to the range <!--Missing Equation-->.
 
The {{code|GL_MIN}} and {{code|GL_MAX}} equations are useful for applications that analyze image data (image thresholding against a constant color, for example). The {{code|GL_FUNC_ADD}} equation is useful for antialiasing and transparency, among other things.
 
Initially, both the RGB blend equation and the alpha blend equation are set to {{code|GL_FUNC_ADD}}.
 
 
 
== Notes ==
 
The {{code|GL_MIN}}, and {{code|GL_MAX}} equations do not use the source or destination factors, only the source and destination colors.
 
== Errors ==
 
{{code|GL_INVALID_ENUM}} is generated if ''mode'' is not one of {{code|GL_FUNC_ADD}}, {{code|GL_FUNC_SUBTRACT}}, {{code|GL_FUNC_REVERSE_SUBTRACT}}, {{code|GL_MAX}}, or {{code|GL_MIN}}.
 
{{code|GL_INVALID_VALUE}} is generated by '''glBlendEquationi''' if ''buf'' is greater than or equal to the value of {{code|GL_MAX_DRAW_BUFFERS}}.
 
== Associated Gets ==
 
[[GLAPI/glGet|glGet]] with an argument of {{code|GL_BLEND_EQUATION_RGB}}
 
[[GLAPI/glGet|glGet]] with an argument of {{code|GL_BLEND_EQUATION_ALPHA}}
 
== See Also ==
 
[[GLAPI/glBlendColor|glBlendColor]], [[GLAPI/glBlendFunc|glBlendFunc]][[GLAPI/glBlendFuncSeparate|glBlendFuncSeparate]]
 
== Copyright ==
 
Copyright © 1991-2006 Silicon Graphics, Inc. This document is licensed under the SGI Free Software B License. For details, see [http://oss.sgi.com/projects/FreeB/ http://oss.sgi.com/projects/FreeB/].
 
[[Category:API Reference 4]]

Latest revision as of 19:01, 6 September 2012