[Top]
GL
|
Method GL.glLight()
- Method
glLight
-
void glLight(int light, int pname, float|int|array(float|int) param)
- Description
-
glLight sets the values of individual light source parameters.
light names the light and is a symbolic name of the form GL_LIGHT i,
where 0 \(<= i < GL_MAX_LIGHTS .
pname specifies one of ten light source parameters,
again by symbolic name.
params is either a single value or a pointer to an array that contains
the new values.
To enable and disable lighting calculation, call glEnable
and glDisable with argument GL_LIGHTING . Lighting is
initially disabled.
When it is enabled,
light sources that are enabled contribute to the lighting calculation.
Light source i is enabled and disabled using glEnable and
glDisable with argument GL_LIGHT i.
The ten light parameters are as follows:
| GL_AMBIENT
| params contains 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_DIFFUSE
| params contains 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
for GL_LIGHT0 is (1, 1, 1, 1); for other lights, the
initial value is (0, 0, 0, 0).
|
| GL_SPECULAR
| params contains 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 representable value maps to -1.0.
Floating-point values are mapped directly.
Neither integer nor floating-point values are clamped.
The initial value
for GL_LIGHT0 is (1, 1, 1, 1); for other lights, the
initial value is (0, 0, 0, 0).
|
| GL_POSITION
| params contains 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 when
glLight is called (just as if it were a point),
and it is stored in eye coordinates.
If the w component of the position is 0,
the light is treated as a directional source.
Diffuse and specular lighting calculations take the light's direction,
but not its actual position,
into account,
and attenuation is disabled.
Otherwise,
diffuse and specular lighting calculations are based on the actual location
of the light in eye coordinates,
and attenuation is enabled.
The initial position is (0, 0, 1, 0);
thus, the initial light source is directional,
parallel to, and iht in >
| | glClear() |
| glClearAccum() |
| glClearColor() |
| glClearDepth() |
| glClearIndex() |
| glClearStencil() |
| glColor() |
| glColorMask() |
| glColorMaterial() |
| glCopyPixels() |
| glCopyTexImage1D() |
| glCopyTexImage2D() |
| glCopyTexSubImage1D() |
| glCopyTexSubImage2D() |
| glCullFace() |
| glDeleteLists() |
| glDepthFunc() |
| glDepthMask() |
| glDepthRange() |
| glDisable() |
| glDisableClientState() |
| glDrawArrays() |
| glDrawBuffer() |
| glDrawPixels() |
| glEdgeFlag() |
| glEnable() |
| glEnableClientState() |
| glEnd() |
| glEndList() |
| glEvalCoord() |
| glEvalPoint() |
| glFinish() |
| glFlush() |
| glFog() |
| glFrontFace() |
| glFrustum() |
| glGenLists() |
| glGetError() |
| glGetString() |
| glHint() |
| glIndex() |
| glIndexMask() |
| glInitNames() |
| glIsEnabled() |
| glIsList() |
| glIsTexture() |
| glLight() |
| glLightModel() |
| glLineStipple() |
| glLineWidth() |
| glListBase() |
| glLoadIdentity() |
| glLoadMatrix() |
| glLoadName() |
| glLogicOp() |
| glMaterial() |
| glMatrixMode() |
| glMultMatrix() |
| glNewList() |
| glNormal() |
| glOrtho() |
| glPassThrough() |
| glPixelZoom() |
| glPointSize() |
| glPolygonMode() |
| glPolygonOffset() |
| glPopAttrib() |
| glPopClientAttrib() |
| glPopMatrix() |
| glPopName() |
| | |
|