GLLIGHT(3G) UNIX Programmer's Manual GLLIGHT(3G)

glLightf, glLighti, glLightfv, glLightiv- set light source parameters

voidglLightf( GLenumlight, GLenumpname, GLfloatparam) voidglLighti( GLenumlight, GLenumpname, GLintparam)

lightSpecifies a light. The number of lights depends on the implementation, but at least eight lights are supported. They are identified by symbolic names of the formGL_LIGHTi where 0 ≤ i <GL_MAX_LIGHTS.pnameSpecifies a single-valued light source parameter forlight.GL_SPOT_EXPONENT,GL_SPOT_CUTOFF,GL_CONSTANT_ATTENUATION,GL_LINEAR_ATTENUATION, andGL_QUADRATIC_ATTENUATIONare accepted.paramSpecifies the value that parameterpnameof light sourcelightwill be set to.

voidglLightfv( GLenumlight, GLenumpname, const GLfloat *params) voidglLightiv( GLenumlight, GLenumpname, const GLint *params)

lightSpecifies a light. The number of lights depends on the implementation, but at least eight lights are sup- ported. They are identified by symbolic names of the formGL_LIGHTi where 0 ≤ i <GL_MAX_LIGHTS.pnameSpecifies a light source parameter forlight.GL_AMBIENT,GL_DIFFUSE,GL_SPECULAR,GL_POSITION,GL_SPOT_CUTOFF,GL_SPOT_DIRECTION,GL_SPOT_EXPONENT,GL_CONSTANT_ATTENUATION,GL_LINEAR_ATTENUATION, andGL_QUADRATIC_ATTENUATIONare accepted.paramsMirOS BSD #10-current Printed 03.04.2017 1 GLLIGHT(3G) UNIX Programmer's Manual GLLIGHT(3G) Specifies a pointer to the value or values that parame- terpnameof light sourcelightwill be set to.

glLightsets the values of individual light source parame- ters.lightnames the light and is a symbolic name of the formGL_LIGHTi, where 0 ≤ i <GL_MAX_LIGHTS.pnamespecifies one of ten light source parameters, again by symbolic name.paramsis either a single value or a pointer to an array that contains the new values. To enable and disable lighting calculation, callglEnableandglDisablewith argumentGL_LIGHTING. Lighting is ini- tially disabled. When it is enabled, light sources that are enabled contribute to the lighting calculation. Light source i is enabled and disabled usingglEnableandglDisablewith argumentGL_LIGHTi. The ten light parameters are as follows:GL_AMBIENTparamscontains four integer or floating-point values that specify the ambient RGBA intensity of the light. Integer values are mapped linearly such that the most positive representable value maps to 1.0, and the most negative representable value maps to -1.0. Floating-point values are mapped directly. Neither integer nor floating- point values are clamped. The initial ambient light intensity is (0, 0, 0, 1).GL_DIFFUSEparamscontains four integer or floating-point values that specify the diffuse RGBA intensity of the light. Integer values are mapped linearly such that the most positive representable value maps to 1.0, and the most negative representable value maps to -1.0. Floating-point values are mapped directly. Neither integer nor floating- point values are clamped. The initial value forGL_LIGHT0is (1, 1, 1, 1); for other lights, the initial value is (0, 0, 0, 0).GL_SPECULARparamscontains four integer or floating-point values that specify the specular RGBA intensity of the light. Integer values are mapped linearly such that the most positive representable value maps to 1.0, and the most negative MirOS BSD #10-current Printed 03.04.2017 2 GLLIGHT(3G) UNIX Programmer's Manual GLLIGHT(3G) representable value maps to -1.0. Floating-point values are mapped directly. Neither integer nor floating- point values are clamped. The initial value forGL_LIGHT0is (1, 1, 1, 1); for other lights, the initial value is (0, 0, 0, 0).GL_POSITIONparamscontains four integer or floating-point values that specify the position of the light in homogeneous object coordinates. Both integer and floating-point values are mapped directly. Neither integer nor floating- point values are clamped. The position is transformed by the modelview matrix whenglLightis called (just as if it were a point), and it is stored in eye coordinates. If the w com- ponent of the position is 0, the light is treated as a directional source. Dif- fuse and specular lighting calculations take the light's direction, but not its actual position, into account, and attenuation is disabled. Otherwise, dif- fuse and specular lighting calculations are based on the actual location of the light in eye coordinates, and attenua- tion is enabled. The initial position is (0, 0, 1, 0); thus, the initial light source is directional, parallel to, and in the direction of the -z axis.GL_SPOT_DIRECTIONparamscontains three integer or floating-point values that specify the direction of the light in homogeneous object coordinates. Both integer and floating-point values are mapped directly. Neither integer nor floating- point values are clamped. The spot direction is transformed by the inverse of the modelview matrix whenglLightis called (just as if it were a normal), and it is stored in eye coordi- nates. It is significant only whenGL_SPOT_CUTOFFis not 180, which it is initially. The initial direction is (0, 0, -1).GL_SPOT_EXPONENTparamsis a single integer or floating- MirOS BSD #10-current Printed 03.04.2017 3 GLLIGHT(3G) UNIX Programmer's Manual GLLIGHT(3G) point value that specifies the intensity distribution of the light. Integer and floating-point values are mapped directly. Only values in the range [0,128] are accepted. Effective light intensity is attenuated by the cosine of the angle between the direction of the light and the direction from the light to the vertex being lighted, raised to the power of the spot exponent. Thus, higher spot exponents result in a more focused light source, regardless of the spot cutoff angle (seeGL_SPOT_CUTOFF, next paragraph). The initial spot exponent is 0, resulting in uniform light distribution.GL_SPOT_CUTOFFparamsis a single integer or floating- point value that specifies the maximum spread angle of a light source. Integer and floating-point values are mapped directly. Only values in the range [0,90] and the special value 180 are accepted. If the angle between the direction of the light and the direction from the light to the vertex being lighted is greater than the spot cutoff angle, the light is completely masked. Otherwise, its intensity is controlled by the spot exponent and the attenuation factors. The initial spot cutoff is 180, resulting in uniform light distribution.GL_CONSTANT_ATTENUATIONGL_LINEAR_ATTENUATIONGL_QUADRATIC_ATTENUATIONparamsis a single integer or floating- point value that specifies one of the three light attenuation factors. Integer and floating-point values are mapped directly. Only nonnegative values are accepted. If the light is positional, rather than directional, its intensity is attenuated by the reciprocal of the sum of the constant factor, the linear factor times the distance between the light and the vertex being lighted, and the quadratic factor times the square of the same distance. The initial MirOS BSD #10-current Printed 03.04.2017 4 GLLIGHT(3G) UNIX Programmer's Manual GLLIGHT(3G) attenuation factors are (1, 0, 0), resulting in no attenuation.

It is always the case thatGL_LIGHTi =GL_LIGHT0+ i.

GL_INVALID_ENUMis generated if eitherlightorpnameis not an accepted value.GL_INVALID_VALUEis generated if a spot exponent value is specified outside the range [0,128], or if spot cutoff is specified outside the range [0,90] (except for the special value 180), or if a negative attenuation factor is speci- fied.GL_INVALID_OPERATIONis generated ifglLightis executed between the execution ofglBeginand the corresponding exe- cution ofglEnd.

glGetLightglIsEnabledwith argumentGL_LIGHTING

glColorMaterial(3G),glLightModel(3G),glMaterial(3G)MirOS BSD #10-current Printed 03.04.2017 5

Generated on 2017-04-03 16:26:17 by `$MirOS: src/scripts/roff2htm,v 1.88 2017/01/29 00:51:06 tg Exp $`

These manual pages and other documentation are copyrighted by their respective writers;
their source is available at our CVSweb,
AnonCVS, and other mirrors. The rest is Copyright © 2002–2017 The MirOS Project, Germany.

This product includes material
provided by **mirabilos**.

This manual page’s HTML representation is supposed to be valid XHTML/1.1; if not, please send a bug report — diffs preferred.