set_fog


Description:


public void set_fog (Color fog_color, FogMode mode, float density, float z_near, float z_far)

Enables fogging.

Note:

Use CoglSnippet shader api for fog

Fogging causes vertices that are further away from the eye to be rendered with a different color. The color is determined according to the chosen fog mode; at it's simplest the color is linearly interpolated so that vertices at z_near are drawn fully with their original color and vertices at z_far are drawn fully with fog_color. Fogging will remain enabled until you call disable_fog.

Note:

The fogging functions only work correctly when primitives use unmultiplied alpha colors. By default Cogl will premultiply textures and set_source_color will premultiply colors, so unless you explicitly load your textures requesting an unmultiplied internal format and use set_color you can only use fogging with fully opaque primitives. This might improve in the future when we can depend on fragment shaders.

Parameters:

fog_color

The color of the fog

mode

A FogMode that determines the equation used to calculate the fogging blend factor.

density

Used by EXPONENTIAL and by EXPONENTIAL_SQUARED equations.

z_near

Position along Z axis where no fogging should be applied

z_far

Position along Z axis where full fogging should be applied


Namespace: Cogl
Package: cogl-1.0