manpagez: man pages & more
info mathgl
Home | html | info | man
[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.1.2 Lighting

There are several functions for setup lighting. The general function is Light(bool) which switch on/off the lighting for overall plot. It influence only for graphics which created after Light() call (with one exception, mglGraphGL). Generally MathGL support up to 10 independent light sources. But in OpenGL mode only 8 of light sources is used due to OpenGL limitations. The position, color, brightness of each light source can be set separately. By default only one light source is active. It is source number 0 with white color, located at top of the plot.

Method on mglGraph: void Light (bool enable)

Sets the using of light on/off for overall plot. It is recommended to call this function before any plotting command. Default value is lightning off.

Method on mglGraph: void Light (int n, bool enable)

Switch on/off n-th light source separately.

Method on mglGraph: void Light (int n, mglPoint p, mglColor c, float bright=0.5, bool infty=true)
Method on mglGraph: void Light (int n, mglPoint p, char c='w', float bright=0.5, bool infty=true)

The function adds a light source with identification n at position p. The color of light is c (white by default). The brightness of light is bright which must be in range [0,1]. Flag infty=true puts the source to infinite distance (for the faster drawing). It is recommended to call this function before any plotting command.

Method on mglGraph: void Ambient (float bright=0.5)

Sets the brightness of ambient light. The value should be in range [0,1]. It is recommended to call this function before any plotting command.


© manpagez.com 2000-2026
Individual documents may contain additional copyright information.