GLKEffectPropertyFog Class Reference

Inherits from
Conforms to
Framework
/System/Library/Frameworks/GLKit.framework
Availability
Available in OS X v10.8 and later.
Declared in
GLKEffectPropertyFog.h

Overview

The GLKEffectPropertyFog class defines properties used to configure how fog is applied to an effect. These properties are specifically designed to mimic the fog calculations provided by OpenGL ES 1.1.

When fog is enabled, the fog component is calculated and clamped to a range from 0.0 to 1.0. Then, the fog value is used as a blending factor between the computed fragment color and the fog color.

Tasks

Enabling Fog

Choosing the Fog Mode

Fog Properties

Properties

color

The color of the fog at maximum density.

@property(nonatomic, assign) GLKVector4 color
Availability
  • Available in OS X v10.8 and later.
Declared In
GLKEffectPropertyFog.h

density

The rate at which the fog exponent increases.

@property(nonatomic, assign) GLfloat density
Discussion

This property is ignored when the mode property is set to GLKFogModeLinear.

Availability
  • Available in OS X v10.8 and later.
Declared In
GLKEffectPropertyFog.h

enabled

A Boolean value that indicates whether fog is applied to the fragment color.

@property(nonatomic, assign) GLboolean enabled
Discussion

If the value of this property is GL_TRUE, then fog calculations are performed each time a fragment is computed. If the value of this property is GL_FALSE, then fog calculations are skipped. The default value is GL_TRUE.

Availability
  • Available in OS X v10.8 and later.
Declared In
GLKEffectPropertyFog.h

end

The distance in eye coordinates where fog completely covers the color fragment.

@property(nonatomic, assign) GLfloat end
Discussion

This property is ignored when the mode property is set to GLKFogModeExp or GLKFogModeExp2.

Availability
  • Available in OS X v10.8 and later.
Declared In
GLKEffectPropertyFog.h

mode

The algorithm used to compute the density of the fog applied to the fragment color.

@property(nonatomic, assign) GLint mode
Availability
  • Available in OS X v10.8 and later.
Declared In
GLKEffectPropertyFog.h

start

The minimum distance in eye coordinates before fog is applied to the fragment color.

@property(nonatomic, assign) GLfloat start
Discussion

This property is ignored when the mode property is set to GLKFogModeExp or GLKFogModeExp2.

Availability
  • Available in OS X v10.8 and later.
Declared In
GLKEffectPropertyFog.h

Constants

GLKFogMode

A mode that describes how the fog component is calculated for the fragment.

typedef enum GLKFogMode : GLint
{
   GLKFogModeExp=0,
   GLKFogModeExp2,
   GLKFogModeLinear
} GLKFogMode;
Constants
GLKFogModeExp

The fog component is calculated as exp(-density * distance) and clamped to the range [0.0, 1.0].

Available in OS X v10.8 and later.

Declared in GLKEffectPropertyFog.h.

GLKFogModeExp2

The fog component is calculated as exp(-(density * distance)^2) and clamped to the range [0.0, 1.0].

Available in OS X v10.8 and later.

Declared in GLKEffectPropertyFog.h.

GLKFogModeLinear

The fog component is calculated as (end - distance) / (end - start) and clamped to the range [0.0, 1.0].

Available in OS X v10.8 and later.

Declared in GLKEffectPropertyFog.h.