1
0
Fork 0

[fog] Document that fogging only works with opaque or unmultipled colors

The fixed function fogging provided by OpenGL only works with unmultiplied
colors (or if the color has an alpha of 1.0) so since we now premultiply
textures and colors by default a note to this affect has been added to
clutter_stage_set_fog and cogl_set_fog.

test-depth.c no longer uses clutter_stage_set_fog for this reason.

In the future when we can depend on fragment shaders we should also be
able to support fogging of premultiplied primitives.
This commit is contained in:
Robert Bragg 2009-06-07 11:54:05 +01:00
parent e6da6df8a8
commit 58fa6917c2

View file

@ -386,13 +386,22 @@ gboolean cogl_get_backface_culling_enabled (void);
* @z_near: Position along z-axis where no fogging should be applied
* @z_far: Position along z-axes where full fogging should be applied
*
* Enables fogging. 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
* cogl_disable_fog().
* Enables fogging. 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 cogl_disable_fog().
*
* Note: The fogging functions only work correctly when primitives use
* unmultiplied alpha colors. By default Cogl will premultiply textures
* and cogl_set_source_color will premultiply colors, so unless you
* explicitly load your textures requesting an unmultiplied
* internal_format and use cogl_material_set_color you can only use
* fogging with fully opaque primitives.
*
* We can look to improve this in the future when we can depend on
* fragment shaders.
*/
void cogl_set_fog (const CoglColor *fog_color,
CoglFogMode mode,