glGetMaterialiv function
The glGetMaterialfv and glGetMaterialiv functions return material parameters.
Syntax
void WINAPI glGetMaterialiv(
GLenum face,
GLenum pname,
GLint *params
);
Parameters
-
face
-
Specifies which of the two materials is being queried. GL_FRONT or GL_BACK are accepted, representing the front and back materials, respectively.
-
pname
-
The material parameter to return. The following values are accepted.
Value Meaning - GL_AMBIENT
The params parameter returns four integer or floating-point values representing the ambient reflectance of the material. Integer values, when requested, are linearly mapped from the internal floating-point representation such that 1.0 maps to the most positive representable integer value, and -1.0 maps to the most negative representable integer value. If the internal value is outside the range [-1,1], the corresponding integer return value is undefined. - GL_DIFFUSE
The params parameter returns four integer or floating-point values representing the diffuse reflectance of the material. Integer values, when requested, are linearly mapped from the internal floating-point representation such that 1.0 maps to the most positive representable integer value, and -1.0 maps to the most negative representable integer value. If the internal value is outside the range [-1,1], the corresponding integer return value is undefined. - GL_SPECULAR
The params parameter returns four integer or floating-point values representing the specular reflectance of the material. Integer values, when requested, are linearly mapped from the internal floating-point representation such that 1.0 maps to the most positive representable integer value, and -1.0 maps to the most negative representable integer value. If the internal value is outside the range [-1,1], the corresponding integer return value is undefined. - GL_EMISSION
The params parameter returns four integer or floating-point values representing the emitted light intensity of the material. Integer values, when requested, are linearly mapped from the internal floating-point representation such that 1.0 maps to the most positive representable integer value, and -1.0 maps to the most negative representable integer value. If the internal value is outside the range [-1,1], the corresponding integer return value is undefined. - GL_SHININESS
The params parameter returns one integer or floating-point value representing the specular exponent of the material. Integer values, when requested, are computed by rounding the internal floating-point value to the nearest integer value. - GL_COLOR_INDEXES
The params parameter returns three integer or floating-point values representing the ambient, diffuse, and specular indexes of the material. Use these indexes only for color-index lighting. (The other parameters are all used only for RGBA lighting.) Integer values, when requested, are computed by rounding the internal floating-point values to the nearest integer values. -
params
-
Returns the requested data.
Return value
This function does not return a value.
Error codes
The following error codes can be retrieved by the glGetError function.
Name | Meaning |
---|---|
|
target or query was not an accepted value. |
|
The function was called between a call to glBegin and the corresponding call to glEnd. |
Remarks
The glGetMaterial function returns in params the value or values of parameter pname of material face.
If an error is generated, no change is made to the contents of params.
Requirements
Requirement | Value |
---|---|
Minimum supported client |
Windows 2000 Professional [desktop apps only] |
Minimum supported server |
Windows 2000 Server [desktop apps only] |
Header |
|
Library |
|
DLL |
|