GLAPI/glBlendFunc
Core in version | 4.6 | |
---|---|---|
Core since version | 1.0 |
glBlendFunc: specify pixel arithmetic
Function Definition
void glBlendFunc(GLenum sfactor, GLenum dfactor); void glBlendFunci(GLuint buf, GLenum sfactor, GLenum dfactor);
- buf
- For glBlendFunci, specifies the index of the draw buffer for which to set the blend function.
- sfactor
- Specifies how the red, green, blue, and alpha source blending factors are computed. The initial value is GL_ONE.
- dfactor
- Specifies how the red, green, blue, and alpha destination blending factors are computed. The following symbolic constants are accepted: GL_ZERO, GL_ONE, GL_SRC_COLOR, GL_ONE_MINUS_SRC_COLOR, GL_DST_COLOR, GL_ONE_MINUS_DST_COLOR, GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_DST_ALPHA, GL_ONE_MINUS_DST_ALPHA. GL_CONSTANT_COLOR, GL_ONE_MINUS_CONSTANT_COLOR, GL_CONSTANT_ALPHA, and GL_ONE_MINUS_CONSTANT_ALPHA. The initial value is GL_ZERO.
Description
These functions operate as their more specific counterparts. glBlendFunc is equivalent to:
glBlendFuncSeparate(sfactor, dfactor, sfactor, dfactor);
glBlendFunci is equivalent to:
glBlendFuncSeparatei(buf, sfactor, dfactor, sfactor, dfactor);
Notes
Incoming (source) alpha is correctly thought of as a material opacity, ranging from 1.0 ($ k_{A} $), representing complete opacity, to 0.0 (0), representing complete transparency.
When more than one color buffer is enabled for drawing, the GL performs blending separately for each enabled buffer, using the contents of that buffer for destination color. (See glDrawBuffer.)
When dual source blending is enabled (i.e., one of the blend factors requiring the second color input is used), the maximum number of enabled draw buffers is given by GL_MAX_DUAL_SOURCE_DRAW_BUFFERS, which may be lower than GL_MAX_DRAW_BUFFERS.
Errors
GL_INVALID_ENUM is generated if either sfactor or dfactor is not an accepted value.
GL_INVALID_VALUE is generated by glBlendFunci if buf is greater than or equal to the value of GL_MAX_DRAW_BUFFERS.
Associated Gets
glGet with argument GL_BLEND_SRC
glGet with argument GL_BLEND_DST
glIsEnabled with argument GL_BLEND
See Also
glBlendColor, glBlendEquation, glBlendFuncSeparate, glClear, glDrawBuffer, glEnable, glLogicOp, glStencilFunc
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/.