# OpenGL.GL.NV.blend_equation_advanced

OpenGL extension NV.blend_equation_advanced

This module customises the behaviour of the
OpenGL.raw.GL.NV.blend_equation_advanced to provide a more
Python-friendly API

Overview (from the spec)

This extension adds a number of "advanced" blending equations that can be
used to perform new color blending operations, many of which are more
complex than the standard blend modes provided by unextended OpenGL. This
extension provides two different extension string entries:

- NV_blend_equation_advanced: Provides the new blending equations, but guarantees defined results only if each sample is touched no more than once in any single rendering pass. The command BlendBarrierNV() is provided to indicate a boundary between passes.

- NV_blend_equation_advanced_coherent: Provides the new blending equations, and guarantees that blending is done coherently and in API primitive ordering. An enable is provided to allow implementations to opt out of fully coherent blending and instead behave as though only NV_blend_equation_advanced were supported.

Some implementations may support NV_blend_equation_advanced without
supporting NV_blend_equation_advanced_coherent.

In unextended OpenGL, the set of blending equations is limited, and can be
expressed very simply. The MIN and MAX blend equations simply compute
component-wise minimums or maximums of source and destination color
components. The FUNC_ADD, FUNC_SUBTRACT, and FUNC_REVERSE_SUBTRACT
multiply the source and destination colors by source and destination
factors and either add the two products together or subtract one from the
other. This limited set of operations supports many common blending
operations but precludes the use of more sophisticated transparency and
blending operations commonly available in many dedicated imaging APIs.

This extension provides a number of new "advanced" blending equations.
Unlike traditional blending operations using the FUNC_ADD equation, these
blending equations do not use source and destination factors specified by
BlendFunc. Instead, each blend equation specifies a complete equation
based on the source and destination colors. These new blend equations are
used for both RGB and alpha components; they may not be used to perform
separate RGB and alpha blending (via functions like
BlendEquationSeparate).

These blending operations are performed using premultiplied colors, where
RGB colors stored in the framebuffer are considered to be multiplied by
alpha (coverage). The fragment color may be considered premultiplied or
non-premultiplied, according the BLEND_PREMULTIPLIED_SRC_NV blending
parameter (as specified by the new BlendParameteriNV function). If
fragment color is considered non-premultiplied, the (R,G,B) color
components are multiplied by the alpha component prior to blending. For
non-premultiplied color components in the range
the corresponding
premultiplied color component would have values in the range [0*A,1*A
.

Many of these advanced blending equations are formulated where the result
of blending source and destination colors with partial coverage have three
separate contributions: from the portions covered by both the source and
the destination, from the portion covered only by the source, and from the
portion covered only by the destination. The blend parameter
BLEND_OVERLAP_NV can be used to specify a correlation between source and
destination pixel coverage. If set to CONJOINT_NV, the source and
destination are considered to have maximal overlap, as would be the case
if drawing two objects on top of each other. If set to DISJOINT_NV, the
source and destination are considered to have minimal overlap, as would be
the case when rendering a complex polygon tessellated into individual
non-intersecting triangles. If set to UNCORRELATED_NV (default), the
source and destination coverage are assumed to have no spatial correlation
within the pixel.

In addition to the coherency issues on implementations not supporting
NV_blend_equation_advanced_coherent, this extension has several
limitations worth noting. First, the new blend equations are not
supported while rendering to more than one color buffer at once; an
INVALID_OPERATION will be generated if an application attempts to render
any primitives in this unsupported configuration. Additionally, blending
precision may be limited to 16-bit floating-point, which could result in a
loss of precision and dynamic range for framebuffer formats with 32-bit
floating-point components, and in a loss of precision for formats with 12-
and 16-bit signed or unsigned normalized integer components.

The official definition of this extension is available here:
http://www.opengl.org/registry/specs/NV/blend_equation_advanced.txt

## Functions

## Constants

GL_BLEND_OVERLAP_NV (37505)

GL_BLEND_PREMULTIPLIED_SRC_NV (37504)

GL_BLUE_NV (6405)

GL_COLORBURN_NV (37530)

GL_COLORDODGE_NV (37529)

GL_CONJOINT_NV (37508)

GL_CONTRAST_NV (37537)

GL_DARKEN_NV (37527)

GL_DIFFERENCE_NV (37534)

GL_DISJOINT_NV (37507)

GL_DST_ATOP_NV (37519)

GL_DST_IN_NV (37515)

GL_DST_NV (37511)

GL_DST_OUT_NV (37517)

GL_DST_OVER_NV (37513)

GL_EXCLUSION_NV (37536)

GL_GREEN_NV (6404)

GL_HARDLIGHT_NV (37531)

GL_HARDMIX_NV (37545)

GL_HSL_COLOR_NV (37551)

GL_HSL_HUE_NV (37549)

GL_HSL_LUMINOSITY_NV (37552)

GL_HSL_SATURATION_NV (37550)

GL_INVERT (5386)

GL_INVERT_OVG_NV (37556)

GL_INVERT_RGB_NV (37539)

GL_LIGHTEN_NV (37528)

GL_LINEARBURN_NV (37541)

GL_LINEARDODGE_NV (37540)

GL_LINEARLIGHT_NV (37543)

GL_MINUS_CLAMPED_NV (37555)

GL_MINUS_NV (37535)

GL_MULTIPLY_NV (37524)

GL_OVERLAY_NV (37526)

GL_PINLIGHT_NV (37544)

GL_PLUS_CLAMPED_ALPHA_NV (37554)

GL_PLUS_CLAMPED_NV (37553)

GL_PLUS_DARKER_NV (37522)

GL_PLUS_NV (37521)

GL_RED_NV (6403)

GL_SCREEN_NV (37525)

GL_SOFTLIGHT_NV (37532)

GL_SRC_ATOP_NV (37518)

GL_SRC_IN_NV (37514)

GL_SRC_NV (37510)

GL_SRC_OUT_NV (37516)

GL_SRC_OVER_NV (37512)

GL_UNCORRELATED_NV (37506)

GL_VIVIDLIGHT_NV (37542)

GL_XOR_NV (5382)

GL_ZERO (0)