Safe Haskell | None |
---|---|
Language | Haskell2010 |
When blending is enabled, colors written to the color buffer will be blended using a formula with the color already there. The three options for the formula are:
- S*s + D*d (
FuncAdd
, the default) - S*s - D*d (
FuncSubtract
) - D*d - S*s (
FuncReverseSubtract
)
where S and D are source and destination color components respectively. The
factors s and d are computed blending factors which can depend on the alpha
component of the source pixel, the destination pixel, or a specified
constant color. See basicBlending
for a common choice.
The order of rendering matters when using blending. The farther-away primitives should be rendered first to get transparent materials to look right. This means a depth test is unhelpful when using blending. Also blending many layers of transparent primitives can significantly degrade performance. For these reasons transparency effects may be better accomplished with an off-screen rendering pass followed by a suitable shader.
blending example program here
- enableBlending :: Blending -> IO ()
- disableBlending :: IO ()
- basicBlending :: Blending
- data Blending = Blending {
- sFactor :: BlendFactor
- dFactor :: BlendFactor
- blendFunc :: BlendEquation
- blendColor :: (Float, Float, Float, Float)
- data BlendEquation
- data BlendFactor
Documentation
enableBlending :: Blending -> IO () Source
Enable blending with the specified blending parameters.
disableBlending :: IO () Source
Disable alpha blending.
basicBlending :: Blending Source
This blending configuration is suitable for ordinary alpha blending transparency effects.
Blending { sFactor = BlendSourceAlpha , dFactor = BlendOneMinusSourceAlpha , blendFunc = FuncAdd }
Blending parameters.
Blending | |
|
data BlendFactor Source
Blending factors.